Cannot debug Flask application in Pycharm 2019.2

Answered

Hey there, 

I'm running a flask application on top of gunicorn. The run configuration has the script path to my virtual env's gunicorn, and I have Gevent compatible enabled in the debugger preferences.

in pycharm CE 2018.3 I can both run and debug my program. from some reason, In version 2019.2.4 I can only run the application while debugging results in an error:

(23706) wsgi starting up on http://0.0.0.0:1337
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1752, in stoptrace
debugger.exiting()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1438, in exiting
sys.stdout.flush()
ValueError: I/O operation on closed file.

Error: maximum recursion depth exceeded while calling a Python object

 

Your help will be appreciated, as downgrading pycharm is not my preferred solution.

Thanks in advance!

0
4 comments

Does it help if you disable Gevent compatible in settings?
There is one known issue https://youtrack.jetbrains.com/issue/PY-34302, but I guess your case is different since it started after the update.

0
Avatar
Permanently deleted user

Nope. This flag seems to be necessary for eventlet, and enabling it is vital for the debugging to succeed in 2018.3. 

I can't tell if the issue you mentioned is connected, but since it originated in February 2019 and the traceback is identical, downgrading may be a solution for him as well. 

0

It would be great if you could report it to https://youtrack.jetbrains.com/issue/PY and provide an example project and steps for reproducing.
We'll investigate and see if it's the same issue as the one I mentioned.

0

By the way, do you run it with --reload option?

0

Please sign in to leave a comment.