[New-bugs-announce] [issue5924] When setting complete PYTHONPATH on Python 3.x, paths in the PYTHONPATH are ignored
Fabio Zadrozny
report at bugs.python.org
Mon May 4 21:06:10 CEST 2009
New submission from Fabio Zadrozny <fabioz at users.sourceforge.net>:
Setting the complete PYTHONPATH in Python 3.x does not work (reported
initially for Pydev:
https://sourceforge.net/tracker/index.php?func=detail&aid=2767830&group_id=85796&atid=577329
). Checked on 3.0.1 and 3.1a2.
I'm not sure if the paths must be the same, but when I did change the
path of the project, the bug was not always reproduced.
I've reproduced it on Windows XP SP3.
To reproduce, extract the ProjectStructure so that you have a path as
c:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src\testcaller_a.py
Then considering your python install is at d:\bin\Python301, set the
pythonpath as:
[C:\temp]set pythonpath=C:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src;C:\Documents
and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_a\src;D:\bin\Python301;D:\bin\Python301\DLLs;D:\bin\Python301\lib;D:\bin\Python301\lib\plat-win;D:\bin\Python301\lib\site-packages
And run the command below:
[C:\temp]d:\bin\Python301\python.exe "c:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src\testcaller_a.py"
Running code is 'c:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src\testcaller_a.py'
The contents of 'sys.path' is:
c:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src
C:\WINDOWS\system32\python30.zip
D:\bin\Python301\DLLs
D:\bin\Python301\lib
D:\bin\Python301\lib\plat-win
D:\bin\Python301
D:\bin\Python301\lib\site-packages
Traceback (most recent call last):
File "c:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src\testcaller_a.py",
line 11, in <module>
from testmod_a import testfunc
ImportError: No module named testmod_a
Note how the module was not properly imported... Now, if the PYTHONPATH
is set without the system folders:
[C:\temp]set pythonpath=C:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src;C:\Documents
and Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_a\src
Running the command line:
[C:\temp]d:\bin\Python301\python.exe "c:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src\testcaller_a.py"
Running code is 'c:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src\testcaller_a.py'
The contents of 'sys.path' is:
c:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src
C:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_b\src
C:\Documents and
Settings\Fabio\Desktop\temp_pydev\ProjectStructure\proj_a\src
C:\WINDOWS\system32\python30.zip
D:\bin\Python301\DLLs
D:\bin\Python301\lib
D:\bin\Python301\lib\plat-win
D:\bin\Python301
D:\bin\Python301\lib\site-packages
'test_print()' in "testmod_a.testfunc" is called.
Properly works. Note that on Python 2.x this works.
----------
components: Interpreter Core, Windows
files: ProjectStructure.zip
messages: 87151
nosy: fabioz
severity: normal
status: open
title: When setting complete PYTHONPATH on Python 3.x, paths in the PYTHONPATH are ignored
type: behavior
versions: Python 3.0, Python 3.1
Added file: http://bugs.python.org/file13874/ProjectStructure.zip
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5924>
_______________________________________
More information about the New-bugs-announce
mailing list