-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PYTHONSAFEPATH is not respected #16235
Comments
A workaround could be to have this in your User settings.json (other settings scopes do not have this setting).
|
Please could you enable logging as follows:
|
Thank you @DonJayamanne for your interest. Complete trace output from a new session:
|
Please could you let me know how exactly you do this, i.e. what is the command or icon you use. |
Got it thanks. |
Found that this empty entry isn't added by the Jupyter extesnion in VS Code, but by the ipykernel package itself (thats used by Jupyter Lab for starting Python kernels). |
Thank you for helping find the root cause. |
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: