PYTHONSAFEPATH is not respected #16235
Labels
bug
Issue identified by VS Code Team member as probable bug
notebook-execution
Kernels issues (start/restart/switch/execution, install ipykernel)
Applies To
What happened?
In workspace .env file:
A test file (can be either .ipynb cell or a
%%
block in a .py file):When the cell is run with the Jupyter extension, the output is:
When run with the Python extension as a Python script, the output is:
Notice the empty string right before the site-packages directory when run with Jupyter. When
sys.flags.safe_path
is set (in this case through the PYTHONSAFEPATH=1 env var), this empty string should not be present.VS Code Version
Version: 1.89.1-cde Commit: 982664f21043ab3f264d1705f0887679853d6af9 Date: 2024-10-30T00:53:56.119Z (2 wks ago) Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Jupyter Extension Version
v2024.4.0
Jupyter logs
Coding Language and Runtime Version
Python v3.11.9
Language Extension Version (if applicable)
Python v2024.12.3
Anaconda Version (if applicable)
micromamba 2.0.2
Running Jupyter locally or remotely?
Local
The text was updated successfully, but these errors were encountered: