[issue16737] Different behaviours in script run directly and via runpy.run_module

Nick Coghlan report at bugs.python.org
Sat Dec 22 11:16:15 CET 2012


Nick Coghlan added the comment:

So yes, any code that assumes __main__.__file__ is a relative path is just plain wrong, as Python provides no such guarantee. It may currently be either relative or absolute at the implementation's discretion.

If the status quo ever changes, it would be to switch to requiring that all module __file__ attributes be absolute paths (including in __main__).

----------

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


More information about the Python-bugs-list mailing list