[issue18416] Move to absolute file paths for module.__file__

Ronald Oussoren report at bugs.python.org
Wed Jul 10 17:17:15 CEST 2013


Ronald Oussoren added the comment:

Isn't this because the first entry of sys.path is '' when python is started without a script? All other paths on sys.path are already absolute paths (tested with a relative path in $PYTHONPATH).

If that's correct, just adding os.getcwd() instead of '' as the first entry of sys.path would fix this issue, and would also make sure that imports of modules next to the script keep working when the script uses os.chdir.

The disadvantage is that some users might depend on the current behavior :-(

----------
nosy: +ronaldoussoren

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


More information about the Python-bugs-list mailing list