[New-bugs-announce] [issue33698] `._pth` does not allow to populate `sys.path` empty entry

Vladimir Chebotarev report at bugs.python.org
Wed May 30 13:12:41 EDT 2018


New submission from Vladimir Chebotarev <vladimir.chebotarev at gmail.com>:

Moving from bpo-29326
====
Hi Steve.

I'll try to explain what is my motivation.

I need a reliable way to run Python (not matter embedded or not) in isolated mode, but still having current directory in `sys.path` (empty entry).

Ironically I could misuse normal mode to simulate isolated mode with specified %PYTHONPATH% (which is not much handy, by the way), but hiding Windows Registry keys would look pretty hard (it is impossible to make a bat/cmd wrapper). Possibility to search %PYTHONPATH% in HKLM entries makes it even worse.

Empty entry in `sys.path` is a extremely popular thing, and many software depend on it. It looks like a bug that isolated mode cannot support such entry.

# How would I fix it.

Possibly we should allow another keyword for adding an empty entry (like we have an exclusion for `import site`).

Ideas are appreciated.

----------
assignee: docs at python
components: Documentation, Windows
messages: 318202
nosy: docs at python, excitoon, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
pull_requests: 6878
severity: normal
status: open
title: `._pth` does not allow to populate `sys.path` empty entry
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33698>
_______________________________________


More information about the New-bugs-announce mailing list