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 <1489035589.22.0.850620268976.issue29723@psf.upfronthosting.co.za>
In-reply-to
Content
Work in progress PR at https://github.com/python/cpython/pull/571

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/__main__.py
    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.
History
Date User Action Args
2017-03-09 04:59:49ncoghlansetrecipients: + ncoghlan, nedbat, ned.deily, eryksun, steve.dower
2017-03-09 04:59:49ncoghlansetmessageid: <1489035589.22.0.850620268976.issue29723@psf.upfronthosting.co.za>
2017-03-09 04:59:49ncoghlanlinkissue29723 messages
2017-03-09 04:59:48ncoghlancreate