This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jack__d
Recipients docs@python, jack__d, mandolaerik
Date 2021-07-02.20:05:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625256324.71.0.577240995327.issue44552@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-07-02 20:05:24jack__dsetrecipients: + jack__d, docs@python, mandolaerik
2021-07-02 20:05:24jack__dsetmessageid: <1625256324.71.0.577240995327.issue44552@roundup.psfhosted.org>
2021-07-02 20:05:24jack__dlinkissue44552 messages
2021-07-02 20:05:24jack__dcreate