After upgrading my scipy installation to the latest source form git, scipy.pkgload() no longer works and gives the following traceback: In [2]: scipy.pkgload() --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-2-5383005a8d36> in <module>() ----> 1 scipy.pkgload() /usr/local/lib/python2.7/dist-packages/numpy/__init__.pyc in pkgload(*packages, **options) 132 133 def pkgload(*packages, **options): --> 134 loader = PackageLoader(infunc=True) 135 return loader(*packages, **options) 136 /usr/local/lib/python2.7/dist-packages/numpy/_import_tools.pyc in __init__(self, verbose, infunc) 15 self.parent_frame = frame = sys._getframe(_level) 16 self.parent_name = eval('__name__',frame.f_globals,frame.f_locals) ---> 17 parent_path = eval('__path__',frame.f_globals,frame.f_locals) 18 if isinstance(parent_path, str): 19 parent_path = [parent_path] <string> in <module>() NameError: name '__path__' is not defined In [3]: scipy.__version__ Out[3]: '0.12.0.dev-8e918cd' ------------------------------------------------------------------------------ I see the pkgload() method is actually called from within numpy (and not scipy, although it's called from scipy), but am not sure whether this is expected. Any ideas? --Johann
On Thu, Jul 26, 2012 at 9:56 PM, Johann Rohwer <jr@sun.ac.za> wrote:
After upgrading my scipy installation to the latest source form git, scipy.pkgload() no longer works and gives the following traceback:
In [2]: scipy.pkgload() --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-2-5383005a8d36> in <module>() ----> 1 scipy.pkgload()
/usr/local/lib/python2.7/dist-packages/numpy/__init__.pyc in pkgload(*packages, **options) 132 133 def pkgload(*packages, **options): --> 134 loader = PackageLoader(infunc=True) 135 return loader(*packages, **options) 136
/usr/local/lib/python2.7/dist-packages/numpy/_import_tools.pyc in __init__(self, verbose, infunc) 15 self.parent_frame = frame = sys._getframe(_level) 16 self.parent_name = eval('__name__',frame.f_globals,frame.f_locals) ---> 17 parent_path = eval('__path__',frame.f_globals,frame.f_locals) 18 if isinstance(parent_path, str): 19 parent_path = [parent_path]
<string> in <module>()
NameError: name '__path__' is not defined
In [3]: scipy.__version__ Out[3]: '0.12.0.dev-8e918cd'
------------------------------------------------------------------------------
I see the pkgload() method is actually called from within numpy (and not scipy, although it's called from scipy), but am not sure whether this is expected. Any ideas?
Must have been broken by e11bf1d24. Now scipy.pkgload() is just an alias for numpy.pkgload(), which simply looks broken. My proposal would be to delete pkgload from the scipy namespace. Ralf
30.07.2012 21:52, Ralf Gommers kirjoitti: [clip]
My proposal would be to delete pkgload from the scipy namespace.
Or maybe have it do __import__('scipy.' + pkgname) I had some old code that assumed pkgload would add the submodule to the main namespace, so maybe trying to restore this could be one option. Alternatively, just remove it... Pauli
On Monday 30 July 2012 22:29:40 Pauli Virtanen wrote:
30.07.2012 21:52, Ralf Gommers kirjoitti: [clip]
My proposal would be to delete pkgload from the scipy namespace.
Or maybe have it do __import__('scipy.' + pkgname) I had some old code that assumed pkgload would add the submodule to the main namespace, so maybe trying to restore this could be one option. Alternatively, just remove it...
I agree that scipy.pkgload('io') and import scipy.io are probably not much different. However, I did find the convenience function scipy.pkgload() useful to load all the subpackages and it would be nice to have that option, although it's of course not a show stopper. --Johann E-pos vrywaringsklousule Hierdie e-pos mag vertroulike inligting bevat en mag regtens geprivilegeerd wees en is slegs bedoel vir die persoon aan wie dit geadresseer is. Indien u nie die bedoelde ontvanger is nie, word u hiermee in kennis gestel dat u hierdie dokument geensins mag gebruik, versprei of kopieer nie. Stel ook asseblief die sender onmiddellik per telefoon in kennis en vee die e-pos uit. Die Universiteit aanvaar nie aanspreeklikheid vir enige skade, verlies of uitgawe wat voortspruit uit hierdie e-pos en/of die oopmaak van enige lês aangeheg by hierdie e-pos nie. E-mail disclaimer This e-mail may contain confidential information and may be legally privileged and is intended only for the person to whom it is addressed. If you are not the intended recipient, you are notified that you may not use, distribute or copy this document in any manner whatsoever. Kindly also notify the sender immediately by telephone, and delete the e-mail. The University does not accept liability for any damage, loss or expense arising from this e-mail and/or accessing any files attached to this e-mail.
On Tue, Jul 31, 2012 at 8:18 AM, Johann Rohwer <jr@sun.ac.za> wrote:
On Monday 30 July 2012 22:29:40 Pauli Virtanen wrote:
30.07.2012 21:52, Ralf Gommers kirjoitti: [clip]
My proposal would be to delete pkgload from the scipy namespace.
Or maybe have it do __import__('scipy.' + pkgname) I had some old code that assumed pkgload would add the submodule to the main namespace, so maybe trying to restore this could be one option.
Since that currently doesn't work (also for released versions) and isn't even any shorter to type than "from scipy import module", I don't really see the point of that. Alternatively, just remove it...
I agree that scipy.pkgload('io') and import scipy.io are probably not much different. However, I did find the convenience function scipy.pkgload() useful to load all the subpackages and it would be nice to have that option, although it's of course not a show stopper.
Reimplementing pkgload() which imports all modules seems fine to me, as long as we document that it's meant for interactive usage only. Ralf
participants (3)
-
Johann Rohwer -
Pauli Virtanen -
Ralf Gommers