ipython: Ipdb and Flask No longer work together
I wanted to mention this here. I can’t be the only that uses flask and ipdb together. Using “import ipdb;ipdb.set_trace()” has worked well in flask apps for the longest time up until a recent update. I tracked it down to ipython. v7.9.0 works but v7.10.0 does not. 😦
Just wanted someone to be aware. Is it possible to get an explanation of what might have caused this? Wondering if there might be a workaround possibly? For now, downgrading to v7.9.0 works for now. Just would be nice to know if I have to look for another solution in the future.
It now gives this error when hitting the breakpoint:
File "/.venv/lib/python3.7/site-packages/IPython/terminal/debugger.py", line 97, in cmdloop
line = self.pt_app.prompt() # reset_current_buffer=True)
File "/.venv/lib/python3.7/site-packages/prompt_toolkit/shortcuts/prompt.py", line 986, in prompt
return self.app.run()
File "/.venv/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 788, in run
return get_event_loop().run_until_complete(self.run_async(pre_run=pre_run))
File "/usr/lib/python3.7/asyncio/events.py", line 644, in get_event_loop
% threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'Thread-3'.
Reproducing this error can be done with the simplest flask app:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
import ipdb;ipdb.set_trace()
return 'Hello, World!'
Thanks!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (7 by maintainers)
Same here with 7.10.1. Rollback to 7.9.0 helps
@jchang10 I don’t think this issue is specific to flask framework. I have faced the same issue in Django as well. Thanks.
Please stop testing and posting that IPython
7.10.0
or7.10.1
are affected – it is not the same issue as the one reported ; I am also aware of it and #12008 will fix the specific error aboutself.inputhook
.