Closed adam-rehin closed 4 months ago
Duplicate of https://github.com/pallets/werkzeug/issues/2702 Duplicate of https://github.com/pallets/werkzeug/issues/2707 Duplicate of https://github.com/pallets/werkzeug/issues/2756 Duplicate of https://github.com/pallets/werkzeug/issues/2782 Duplicate of https://github.com/pallets/werkzeug/issues/2879
Spaces in arguments to subprocess.run
work fine on Windows, this isn't a bug in Werkzeug, Flask, or subprocess.run
. As described in this PyCharm issue and its duplicates, the bug is in PyCharm on Windows and it appears they're actively working on it.
Under Windows 11, PyCharm fails to execute a program properly in debug mode (although it runs in normal mode) due to a problem in Werkzeug
_reloader.py
module.(Interestingly the debugger runs up to the point of failure, which is how I captured the information below).
*Specifically, the function
def restart_with_reloader(self)
fails with error code 2, when " Restarting with stat", at line 273**:exit_code = subprocess.call(args, env=new_environ, close_fds=False)
The error appears to be caused by failure to process the value at
args[3]
i.e.'C:/Program Files (x86)/JetBrains/PyCharm Community Edition 2024.1.1/plugins/python-ce/helpers/pydev/pydevd.py'
because the message output to the console is:C:\Users\Adam.Rehin\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\python.exe: can't open file 'C:\\Program': [Errno 2] No such file or directory
When I replaced the
args[3]
value with'C:/ProgramXXXX Files (x86)/JetBrains/PyCharm Community Edition 2024.1.1/plugins/python-ce/helpers/pydev/pydevd.py'
the error message then read... can't open file 'C:\\ProgramXXXX': [Errno 2] No such file or directory
The values of
args
andnew_environ
immediately before the failure are listed here:Stack (before exiting):
Environment: