Hello Michele,
thanks for the report! I've implemented the new debug_monitor and did
some first investigations.
At least I found a solution which "works". It might be a workaround till
the final soulution is available. Just add threaded=False as additional
parameter, so you get
app.run(debug=True, threaded=False, passthrough_errors=True,
use_debugger=False, use_reloader=False)
I hope this helps for the moment.
Tobias
Michele Petrazzo schrieb am 09.02.26 um 11:25:
Hello,
I'm trying to use Eric to debug a simple Flask application, but I
think that there are some conflicts with Eric and Flask's internal
debugger.
I'm trying all the combination found on Eric debugger ("report all
exceptions", "multiprocess" and so on) and also all the Flask
applications debug / reload and so on parameters founds on:
https://flask.palletsprojects.com/en/stable/debugging/
But:
- with Flask debug (reload enabled by default), Eric cannot follow the
children spawn (this is the last problem if Eric would be able to
debug Flask error, but with Flask reload enabled, Eric return with a
"app.py has terminated with exit code 0")
- with Flask debug on and reload not enabled (use_reloader=False)
without "report all exceptions" on Eric, Eric starts but not catch
exception and has a KeyError (see below), and I see the errors only
Eric terminal
- with Flask reload disabled without Eric breakpoint and without
errors, all goes well, but with breakpoints or errors:
/ File
"/opt/eric_ide/eric_env/lib/python3.13/site-packages/eric7/DebugClients/Python/../../../flask/app.py",
line 865, in dispatch_request
return
self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File
"/opt/eric_ide/eric_env/lib/python3.13/site-packages/eric7/DebugClients/Python/debug_monitor.py",
line 372, in __monitor_exception
self.user_exception(excinfo, False)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File
"/opt/eric_ide/eric_env/lib/python3.13/site-packages/eric7/DebugClients/Python/debug_monitor.py",
line 1091, in user_exception
current_thread = self._dbgClient.threads[thread_id]
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 133533733566144/
Without "report all exceptions":
/ return
self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/devel/flasktest/app.py", line 11, in error
e = 1/0
~^~
ZeroDivisionError: division by zero/
I have eric and flask just installed with a fresh env and pip.
Now I have ended my ideas, so someone has tried and has a working
configurations with Eric and Flask?
Thansk a lot,
Michele
Simplest Flask app:
(venv) pip install Flask
<app.py>
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "Hello, Flask!"
@app.route("/error")
def error():
e = 1/0
return e
if __name__ == "__main__":
app.run(debug=True)
# app.run( debug=True, passthrough_errors=True,
use_debugger=False, use_reloader=False) -> try any of this combination
)
# python app.py
open web browser on http://127.0.0.1:5000 and after try
http://127.0.0.1:5000/error