Change PYTHONPATH before debug #21837
-
Hello, I am trying to set the PYTHONPATH and other environment variables before launching the debugger. The PYTHONPATH is being set using a shell script, which I managed to run using a task with the I'm unsure if I could or should achieve this using tasks. What I need is to execute a command that will correctly update my PYTHONPATH before the debugger launches the script, as I have different PYTHONPATH setups that I need to use. Does anyone have an idea about how I could accomplish this? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
You can set environment variables in your See https://code.visualstudio.com/docs/python/debugging for our docs on debugging. |
Beta Was this translation helpful? Give feedback.
-
I created a feature request to run the debugger in an existing terminal, which would make this easier: microsoft/vscode#241259 And another one to allow specifying shell commands to run before the debugger in debugging configurations: microsoft/vscode-python-debugger#621 Please upvote if you would like this added. |
Beta Was this translation helpful? Give feedback.
-
We now have a way to run the debugger directly from the terminal. Please look for no-config debugging. With that you can set your env variables in the terminal and launch the debugger from the terminal. |
Beta Was this translation helpful? Give feedback.
As I said, you can use a task to launch the process you want to attach to and then have the debugger connect to that process. Otherwise there isn't a way to use a task to launch the debugger itself that I can think of.