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 ncoghlan
Recipients eryksun, ncoghlan, ned.deily, nedbat, steve.dower
Date 2017-03-09.04:59:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Work in progress PR at

I also came up with a reasonably straightforward way of defining the desired "sys.path" initialisation behaviour, which is that the following should all get the *same* sys.path entries:

    python3 -S script_dir/
    python3 -S script_dir
    python3 -I script_dir

None of those should have the current directory on sys.path, but they should *all* have `script_dir` as the first entry on sys.path (and it will be absolute by the time user code runs, even though RunMainAsImporter itself doesn't yet ensure that).

They all differ from the `python3 -m script_dir` and `python3 -m script_dir.__main__` cases, as those are the exact opposite: they *should* have the current directory as the first entry on sys.path and *should not* have `script_dir` in sys.path at all.
Date User Action Args
2017-03-09 04:59:49ncoghlansetrecipients: + ncoghlan, nedbat, ned.deily, eryksun, steve.dower
2017-03-09 04:59:49ncoghlansetmessageid: <>
2017-03-09 04:59:49ncoghlanlinkissue29723 messages
2017-03-09 04:59:48ncoghlancreate