Ipdb and Flask No longer work together
See original GitHub issueI 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!
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
When added ipdb at flask app it raises RuntimeError
Okay now I'm working on simple flask app and it is working but while working I needed ipdb at certain api, after I...
Read more >ipdb · PyPI
ipdb exports functions to access the IPython debugger, which features tab completion, syntax highlighting, better tracebacks, better introspection with the same ...
Read more >Setting Up Sublime Text 3 for Full Stack Python Development
This article details how to set up Sublime Text for full stack Python development.
Read more >Debugging configurations for Python apps in Visual Studio Code
Note: Starting a debugging session through the Debug Panel, F5 or Run > Start Debugging when no configuration exists will also bring up...
Read more >Make the most of Python Jupyter notebooks - Little Umbrellas
You can read more about the magic function system by calling the ... And this is how you clear no longer needed variables...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.