Message166219
It looks like distutils/command from the stdlib is searched first
despite the fact that the first path entry is '/home/stefan/tmp'.
If distutils/command is replaced with a/b, the import works:
$ pwd
/home/stefan/tmp
$
$ ls a/b/
__init__.py xyz.py
$ ls distutils/command/
__init__.py xyz.py
$
$ cat a/b/__init__.py
import sys
sys.path.insert(0, '/home/stefan/tmp')
print(sys.path)
distutils_all = ['xyz']
__import__('a.b',globals(),locals(),distutils_all)
$ cat distutils/command/__init__.py
import sys
sys.path.insert(0, '/home/stefan/tmp')
print(sys.path)
distutils_all = ['xyz']
__import__('distutils.command',globals(),locals(),distutils_all)
$ /home/stefan/usr/bin/python3.3 a/b/__init__.py
['/home/stefan/tmp', '/home/stefan/tmp/a/b', '/home/stefan/usr/lib/python33.zip', '/home/stefan/usr/lib/python3.3', '/home/stefan/usr/lib/python3.3/plat-linux', '/home/stefan/usr/lib/python3.3/lib-dynload', '/home/stefan/.local/lib/python3.3/site-packages', '/home/stefan/usr/lib/python3.3/site-packages']
['/home/stefan/tmp', '/home/stefan/tmp', '/home/stefan/tmp/a/b', '/home/stefan/usr/lib/python33.zip', '/home/stefan/usr/lib/python3.3', '/home/stefan/usr/lib/python3.3/plat-linux', '/home/stefan/usr/lib/python3.3/lib-dynload', '/home/stefan/.local/lib/python3.3/site-packages', '/home/stefan/usr/lib/python3.3/site-packages']
$ /home/stefan/usr/bin/python3.3 distutils/command/__init__.py
['/home/stefan/tmp', '/home/stefan/tmp/distutils/command', '/home/stefan/usr/lib/python33.zip', '/home/stefan/usr/lib/python3.3', '/home/stefan/usr/lib/python3.3/plat-linux', '/home/stefan/usr/lib/python3.3/lib-dynload', '/home/stefan/.local/lib/python3.3/site-packages', '/home/stefan/usr/lib/python3.3/site-packages']
Traceback (most recent call last):
File "distutils/command/__init__.py", line 7, in <module>
__import__('distutils.command',globals(),locals(),distutils_all)
ImportError: No module named 'distutils.command.xyz' |
|
Date |
User |
Action |
Args |
2012-07-23 11:02:12 | skrah | set | recipients:
+ skrah, brett.cannon, pitrou |
2012-07-23 11:02:12 | skrah | set | messageid: <1343041332.67.0.879140505618.issue15434@psf.upfronthosting.co.za> |
2012-07-23 11:02:12 | skrah | link | issue15434 messages |
2012-07-23 11:02:11 | skrah | create | |
|