Jack DeVries <jdevries3...@gmail.com> added the comment:
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. ---------- nosy: +jack__d _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44552> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com