New submission from Jason R. Coombs <jar...@jaraco.com>:

In [this comment](https://bugs.python.org/issue16737#msg282872) I describe an 
issue whereby launching an application via runpy.run_module (aka python -m) 
produces different and unexpected behavior than running the same app via an 
entry script.

In [this followup comment](https://bugs.python.org/issue16737#msg304662), I 
provide more detail on why a user might expect for run_module to mimic the 
behavior of launching a script.

[Nick suggests](https://bugs.python.org/issue16737#msg304707):

> Update sys.path[0] based on __main__.__spec__.origin after [resolving] 
> __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.

----------
messages: 305054
nosy: jason.coombs
priority: normal
severity: normal
status: open
title: [feature] runpy.run_module should mimic script launch behavior for 
sys.path
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31874>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to