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.

classification
Title: sys.path is weird in Windows 10.
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: RyuSh1n, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2021-03-22 04:14 by RyuSh1n, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg389275 - (view) Author: Shin Ryu (RyuSh1n) Date: 2021-03-22 04:14
import sys
print(sys.path)

only on windows, they print sys.path[0] is python38.zip not "".

(docs.python.org says "As initialized upon program startup, the first item of this list, path[0], is the directory containing the script that was used to invoke the Python interpreter. If the script directory is not available (e.g. if the interpreter is invoked interactively or if the script is read from standard input), path[0] is the empty string, which directs Python to search modules in the current directory first. Notice that the script directory is inserted before the entries inserted as a result of PYTHONPATH.")
msg389278 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2021-03-22 06:01
> on windows, they print sys.path[0] is python38.zip not "".

Isolated mode is probably enabled, i.e. `sys.flags.isolated == 1`. It's enabled by default for the embedded distribution [1], or if a "._pth" file exists beside and with the same base name as the executable or DLL (e.g.  "python._pth" or "python38._pth") [2].

---

[1] https://docs.python.org/3/using/windows.html#the-embeddable-package
[2] https://docs.python.org/3/using/windows.html#finding-modules
msg389279 - (view) Author: Shin Ryu (RyuSh1n) Date: 2021-03-22 06:54
Thank you.
History
Date User Action Args
2022-04-11 14:59:43adminsetgithub: 87752
2021-03-22 06:54:25RyuSh1nsetstatus: open -> closed
resolution: not a bug
messages: + msg389279

stage: resolved
2021-03-22 06:01:49eryksunsetnosy: + eryksun
messages: + msg389278
2021-03-22 04:14:42RyuSh1ncreate