[issue13912] ImportError using __import__ and relative level 1

Eric Snow report at bugs.python.org
Tue Jan 31 02:46:57 CET 2012


Eric Snow <ericsnowcurrently at gmail.com> added the comment:

The problem is your level is off and the name is incomplete.  master.pkgA.foo.py should have the following:

__import__('pkgB.bar', master.pkgA.__dict__, level=2).bar

or 

__import__('pkgB.bar', master.pkgA.__dict__, fromlist=['-'], level=2)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13912>
_______________________________________


More information about the Python-bugs-list mailing list