Johannes Kreckel
Johannes Kreckel

Reputation: 12

How to re-define PYTHONPATH --completely-- in Visual Studio Code

I need to re-define the PYTHONPATH within Visual Studio Code (VSC) without it inheriting any values from the default PYTHONPATH set in my shell (zsh).

System Information: macOS: Sonoma 14.6.1, Visual Studio Code: 1.94.0, Python Extension: v2024.16.1, Shell: zsh

Steps I’ve Taken:

Problem: The PYTHONPATH is being modified instead of being set entirely re-defined by the value in the dev.env file.

It starts with the path I defined in dev.env, but it also appends the default PYTHONPATH from my shell. But I need it to replace the PYTHONPATH instead of modifying it.

Additional Attempt: I tried to reset the PYTHONPATH using the following config definition:

"terminal.integrated.env.linux": {
   "PYTHONPATH": null
}

I tried this config in config files/setting below:

But this doesn't work either.

Expected Result: I want to ensure that Visual Studio Code uses only the PYTHONPATH specified in the dev.env file, without inheriting or appending values from the shell environment.

Any idea what else I can do? THX

Upvotes: 0

Views: 48

Answers (0)

Related Questions