JasperVanDenBosch / niprov

provenance for neuroimaging data
BSD 3-Clause "New" or "Revised" License
9 stars 0 forks source link

import niprov fails in script but works in ipython #133

Closed mrjeffs closed 8 years ago

mrjeffs commented 8 years ago

weird: Traceback (most recent call last): File "pylabs/tadpole_qt1_comparison.py", line 3, in from pylabs.utils.paths import getlocaldataroot File "/home/toddr/Software/pylabs/pylabs/init.py", line 5, in from . import utils File "/home/toddr/Software/pylabs/pylabs/utils/init.py", line 7, in from ._options import PylabsOptions # noqa File "/home/toddr/Software/pylabs/pylabs/utils/_options.py", line 1, in import niprov File "/home/toddr/Software/niprov/niprov/init.py", line 11, in from niprov.webapp import serve File "/home/toddr/Software/niprov/niprov/webapp.py", line 1, in from pyramid.config import Configurator File "/home/toddr/Software/anaconda2/lib/python2.7/site-packages/pyramid/config/init.py", line 10, in from webob.exc import WSGIHTTPException as WebobWSGIHTTPException File "/home/toddr/Software/anaconda2/lib/python2.7/site-packages/webob/init.py", line 2, in from webob.request import * File "/home/toddr/Software/anaconda2/lib/python2.7/site-packages/webob/request.py", line 1500, in class LimitedLengthFile(io.RawIOBase): AttributeError: 'module' object has no attribute 'RawIOBase'

JasperVanDenBosch commented 8 years ago

Any changes in your environment? The error suggests a version conflict.

JasperVanDenBosch commented 8 years ago

Oh you are in the pylabs directory which has an io package which is the conflict:

http://stackoverflow.com/questions/23572003/why-io-module-object-has-no-attribute-rawiobase-eventhough-i-am-using-python-2

JasperVanDenBosch commented 8 years ago

Try cd ..

JasperVanDenBosch commented 8 years ago

If that doesn't help we can rename the pylabs.io package

mrjeffs commented 8 years ago

None that I can tell. Just nibabel. As far as I know. How would I tell which is the offending package? J

From: "Jasper J.F. van den Bosch" Reply-To: ilogue/niprov Date: Friday, April 15, 2016 at 6:36 PM To: ilogue/niprov Cc: Jeff Stevenson Subject: Re: [ilogue/niprov] import niprov fails in script but works in ipython (#133)

Any changes in your environment? The error suggests a version conflict.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/ilogue/niprov/issues/133#issuecomment-210706031

mrjeffs commented 8 years ago

Well then. I was simply following where you put your script. Why did you put it there instead of in qt1? Just curious… j

From: "Jasper J.F. van den Bosch" Reply-To: ilogue/niprov Date: Friday, April 15, 2016 at 6:38 PM To: ilogue/niprov Cc: Jeff Stevenson Subject: Re: [ilogue/niprov] import niprov fails in script but works in ipython (#133)

Try cd ..

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/ilogue/niprov/issues/133#issuecomment-210706900

JasperVanDenBosch commented 8 years ago

Also, try not to use relative imports (from . import utils)

JasperVanDenBosch commented 8 years ago

You can still put it in the qt1 location but run the code with your working directory elsewhere.

JasperVanDenBosch commented 8 years ago

import pylabs.utils as utils should fix it too.

mrjeffs commented 8 years ago

How about just moving the script into the qt1 dir? J

From: "Jasper J.F. van den Bosch" Reply-To: ilogue/niprov Date: Friday, April 15, 2016 at 6:39 PM To: ilogue/niprov Cc: Jeff Stevenson Subject: Re: [ilogue/niprov] import niprov fails in script but works in ipython (#133)

If that doesn't help we can rename the pylabs.io package

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/ilogue/niprov/issues/133#issuecomment-210707446

mrjeffs commented 8 years ago

Right, usually I run everything from ~/Software/pylabs. As in Python pylabs/qt1/pipeline.py

From: "Jasper J.F. van den Bosch" Reply-To: ilogue/niprov Date: Friday, April 15, 2016 at 6:41 PM To: ilogue/niprov Cc: Jeff Stevenson Subject: Re: [ilogue/niprov] import niprov fails in script but works in ipython (#133)

You can still put it in the qt1 location but run the code with your working directory elsewhere.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/ilogue/niprov/issues/133#issuecomment-210708882

mrjeffs commented 8 years ago

Ok will try that 1st. J

From: "Jasper J.F. van den Bosch" Reply-To: ilogue/niprov Date: Friday, April 15, 2016 at 6:41 PM To: ilogue/niprov Cc: Jeff Stevenson Subject: Re: [ilogue/niprov] import niprov fails in script but works in ipython (#133)

import pylabs.utils as utils should fix it too.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/ilogue/niprov/issues/133#issuecomment-210709161

mrjeffs commented 8 years ago

I don’t usually. :-) j

From: "Jasper J.F. van den Bosch" Reply-To: ilogue/niprov Date: Friday, April 15, 2016 at 6:40 PM To: ilogue/niprov Cc: Jeff Stevenson Subject: Re: [ilogue/niprov] import niprov fails in script but works in ipython (#133)

Also, try not to use relative imports (from . import utils)

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/ilogue/niprov/issues/133#issuecomment-210708267

mrjeffs commented 8 years ago

Nope not working. Seems the init in pylabs is in conflict no? J

From: "Jasper J.F. van den Bosch" Reply-To: ilogue/niprov Date: Friday, April 15, 2016 at 6:41 PM To: ilogue/niprov Cc: Jeff Stevenson Subject: Re: [ilogue/niprov] import niprov fails in script but works in ipython (#133)

import pylabs.utils as utils should fix it too.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/ilogue/niprov/issues/133#issuecomment-210709161

JasperVanDenBosch commented 8 years ago

I'm closing this as it's a pylabs issue