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 vstinner
Recipients brett.cannon, docs@python, ksato9700, vstinner, xtreak
Date 2020-02-29.22:15:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583014528.95.0.665865633609.issue39379@roundup.psfhosted.org>
In-reply-to
Content
> Is sys.path[0] always absolute, or is it just a side-effect of the site module (i.e. is it absolute even with -S)?

The absolute path is computed way before the site module is imported.

In Python 3.8, _PyPathConfig_ComputeSysPath0() computes sys.path[0] from sys.argv[0]. If the command line contains a script filename, this function uses realpath() on Unix and GetFullPathNameW() on Windows to get the absolute path. If -m is used, getcwd() is called.
History
Date User Action Args
2020-02-29 22:15:28vstinnersetrecipients: + vstinner, brett.cannon, docs@python, ksato9700, xtreak
2020-02-29 22:15:28vstinnersetmessageid: <1583014528.95.0.665865633609.issue39379@roundup.psfhosted.org>
2020-02-29 22:15:28vstinnerlinkissue39379 messages
2020-02-29 22:15:28vstinnercreate