[Python] PyCharm runs a flask app but fails to debug it in python3.11

Discussão em 'Python' iniciado por Stack, Agosto 5, 2025.

  1. Stack

    Stack Membro Participativo

    I have multiple python versions on my machine (3.8, 3.9, 3.10 and 3.11) used with different projects. All versions run fine with PyCharm 2023.1.1 except 3.11. I have a flask-based project which uses 3.11 and it runs fine. Nevertheless, when I try to debug it, the server starts and then throws the following error:

    Connected to pydev debugger (build 231.8770.66)
    *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 https://127.0.0.1:5001
    Press CTRL+C to quit
    Restarting with stat
    C:\Users\SomeUser\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\python.exe: can't open file 'C:\\Program': [Errno 2] No such file or directory
    Process finished with exit code 2


    The virtual environment was created by the PyCharm interpreter automatically and it is using python3.11. It also seems that python.exe tries to open a nonexistent folder called Program which I assume is Program Files, but I do not get why. I tried changing/adding PATHs and PYTHONPATHs. Played with various configuration settings. Installed-reinstalled both python3.11 and PyCharm and so far nothing seems to work. Any suggestions on what might be causing the issue, before I try an old version of PyCharm?

    I tried changing environment variables for python3.11. I tried installing and reinstalling both python3.11 and PyCharm. I tried changing the settings. I enabled the g-event compatibility for the Python Debugger in Pycharm. What I did not try is using an older PyCharm version.

    Continue reading...

Compartilhe esta Página