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

Nick Coghlan report at bugs.python.org
Sat Oct 21 11:12:36 EDT 2017


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Yeah, that one I definitely think could be improved. Could you file a separate RFE suggesting that we update sys.path[0] based on __main__.__spec__.origin after we look up __main__.__spec__?

That way it will only stay as the current directory if the module being executed is in a subdirectory of the current directory, and will otherwise be updated appropriately for wherever we actually found the main module.

----------

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


More information about the Python-bugs-list mailing list