[New-bugs-announce] [issue34103] Python3.7 places cwd instead of a scripts path in sys.path.

AndreasPK report at bugs.python.org
Thu Jul 12 11:06:11 EDT 2018


New submission from AndreasPK <klebinger.andreas at gmx.at>:

Andi at Horzube MINGW64 ~/tmp
$ python3.7 ../pyTest.py
['', 'C:/ghc/msys64/mingw64/lib/python37.zip', 'C:/ghc/msys64/home/Andi/tmp', 'C:/ghc/msys64/mingw64/lib/python3.7', 'C:/ghc/msys64/mingw64/bin', 'C:/ghc/msys64/mingw64/lib/python3.7/lib-dynload', 'C:/ghc/msys64/mingw64/lib/python3.7/site-packages']

Andi at Horzube MINGW64 ~/tmp
$ python3.6 ../pyTest.py
['/home/Andi', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/lib/python3.6/site-packages']

Ignore the path prefix differences, they comes from slight differences how I installed these two versions.

3.6 lists '/home/Andi', path of the script
3.7 lists /home/Andi/tmp , path of cwd

This breaks existing code looking for files (imports primarily) relative to a scripts path.
If a file is placed in the right relative path to cwd it will be picked up over the intended file.

This should be at least mentioned in breaking changes.

----------
messages: 321563
nosy: AndreasPK
priority: normal
severity: normal
status: open
title: Python3.7 places cwd instead of a scripts path in sys.path.
type: security
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34103>
_______________________________________


More information about the New-bugs-announce mailing list