Message396875
This is documented in Doc/library/runpy.rst. Specifically, here:
> For a simple script, the specified code is simply executed in a fresh module namespace. For a valid sys.path entry (typically a zipfile or directory), the entry is first added to the beginning of sys.path. The function then looks for and executes a __main__ module using the updated path. Note that there is no special protection against invoking an existing __main__ entry located elsewhere on sys.path if there is no such module at the specified location.
https://docs.python.org/3/library/runpy.html#runpy.run_path
However, I fully agree that Doc/library/__main__.rst is severely lacking; that's why I've rewritten it! Please consider providing your feedback on the open PR, and see bpo-39452
https://github.com/python/cpython/pull/26883
Note that the new docs in __main__.rst does explicitly reference runpy, so once merged, it'll guide people looking for this information in __main__.rst to the right place. |
|
Date |
User |
Action |
Args |
2021-07-02 20:05:24 | jack__d | set | recipients:
+ jack__d, docs@python, mandolaerik |
2021-07-02 20:05:24 | jack__d | set | messageid: <1625256324.71.0.577240995327.issue44552@roundup.psfhosted.org> |
2021-07-02 20:05:24 | jack__d | link | issue44552 messages |
2021-07-02 20:05:24 | jack__d | create | |
|