Search code examples
pythondebuggingpycharmconsole

PyCharm wrongly recognizes pydevd.py path when debugging on Windows


When I click Debug button on PyCharm, it wrongly recognizes where pydevd.py file resides.

The console message is as below;

C:\Users\young\AppData\Local\Microsoft\WindowsApps\python3.10.exe "C:/Users/young/AppData/Local/Programs/PyCharm Professional/plugins/python/helpers/pydev/pydevd.py" --multiprocess --qt-support=auto --client 127.0.0.1 --port 61823 --file C:\Users\young\Documents\GitHub\some-project\app.py 
Connected to pydev debugger (build 232.10072.31)
 * Serving Flask app 'app'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
 * Restarting with stat
C:\Users\young\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe: can't open file 'C:\\Users\\young\\AppData\\Local\\Programs\\PyCharm': [Errno 2] No such file or directory

Process finished with exit code 2

The reason seems clear. The path /PyCharm Professional/ is trimmed because of whitespace in a path. But I don't know how to fix it up in IDE settings.

Note that PyCharm v2023.2.3 (232.10072.31)


Solution

  • I ended up with WSL(Ubuntu) environment.

    The WSL debug calls pydevd as below, so the wrong path was not recalled.

    /home/young/.virtualenvs/some-project/bin/python /home/young/.pycharm_helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 59943 --file /mnt/c/Users/young/Documents/GitHub/some-project/app.py