-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Cannot execute the python process in Debug when changing the working directory #195
Comments
Please ensure the path Also, you seem to have duplicated the "program": "/Users/aamolodc/cloudtrek/the-dentist/the_dentist/run_web.py",
"cwd": "/Users/aamolodc/cloudtrek/the-dentist/the-dentist/", |
From @alexmolodchikov on October 5, 2017 5:43 Hi Don,
Debugger runs when I change to: When I run another script in the same project (with a different working directory), it works perfectly.
|
Could you try add the following sections into the code and trying to debug: "console": "integratedTerminal", The integrated terminal window should open up and and the python executable should be launched from there. Do let me know what is displayed in the terminal window (all of the contents). |
From @alexmolodchikov on October 6, 2017 3:50 Hey Don, it worked after I ran it in integrated terminal. It seems like when you just execute a process in the debug mode it uses one set of environment variables, and when you run something in integrated terminal - it flushes all the environment variables and sets everything from launch.json file. I would like to investigate further if you're keen, but saying that the issue is solved. Cheers. |
Lets investigate this further if possible. Thanks for the update. |
@alexmolodchikov are you able to share the source, so I could investigate this further? Thanks |
I'm closing this as it has been over a month since we requested more info. If we do get the info at a later date we can re-open this issue. |
I've hit the same issue, with VS code on Linux I have to change the cwd because VS Code cannot find local modules e.g. root If I try to import y.py from x.py then the default settings just don't work because VS Code has no idea how to resolve y.py, when running x.py. So to work around that, I set the cwd to root. At this point, launching x.py from the integrated terminal works fine but the debugger complains that the Python process cannot be found. Both use the same "pythonPath": "${config:python.pythonPath}" setting but the debugger has the different cwd setting. |
@rorycurtis can you provide the same info as requested in new issues? |
@brettcannon I'm not at liberty to share the source code for the app. Happy to grab any other info you think might be useful. |
@rorycurtis that's fine. I'm more looking for log details, raw config details, etc. |
Visual Studio Code: OS and Python User settings { launch.json Debug Console Output Developer Console Output [Extension Host] debugger inspector at %cDebugger listening on port 9333. Failed to launch the Python Process, please validate the path '/home/xxx/anaconda/bin/python' console.ts:123 [Extension Host] (node:8945) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead. |
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"console": "integratedTerminal",
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "${workspaceFolder}/root",
"env": {},
"envFile": "${workspaceFolder}/.env",
"debugOptions": [
"RedirectOutput"
]
}, |
Due to over a month of inactivity after asking for more info, I'm closing this issue. If you are able to provide the requested information in the future we will be happy to open this issue again. |
I'm having the same or similar issue. Running from the terminal works, but not with the debugger. [Running] /usr/bin/python -tt "c:\Dev\google-python-exercises\google-python-exercises\basic\string1.py"
} |
@realdanielbyrne are you using WSL by any chance (based on the interpreter being |
From @alexmolodchikov on October 5, 2017 3:3
Environment data
VS Code version: 1.16.1
Python Extension version: 0.7.0
Python Version: 3.6.2
OS and version: macOS High Sierra 10.13
Actual behavior
Error: spawn /Users/aamolodc/cloudtrek/the-dentist/env/bin/python ENOENT
Failed to launch the Python process, please validate the path
"cwd": "/Users/aamolodc/cloudtrek/the-dentist/the-dentist/"
Expected behavior
Execution of the Python process.
(
runs normally when working directory is set to:
"cwd": "/Users/aamolodc/cloudtrek/the-dentist/"
)
Steps to reproduce:
pythonPath seems to have no effect somehow?
set launch.json to this:
Logs
Output from
Python
output panelError: spawn /Users/aamolodc/cloudtrek/the-dentist/env/bin/python ENOENT
Output from
Console window
(Help->Developer Tools menu)Copied from original issue: DonJayamanne/pythonVSCode#1274
The text was updated successfully, but these errors were encountered: