Hello Michele,
the problems could be solved and are already upsteam. They'll be
deployed in a few days. To work properly, you have to set the first
three parameters as in the example below. threaded and use_reloader can
be any combination but I found out, that when threaded is set to False
and use_reloader set to True, an exception is cought but after that the
reloader isn't informed about the broken thread. You need to change a
file to trigger the reloader, otherwise the server doesn't respond
anymore. That's not an issue by Eric and can be observed on other
debuggers too.
app.run(debug=True, passthrough_errors=True,
use_debugger=False, threaded=True|False, use_reloader=True|False)
Tobias
Tobias Rzepka schrieb am 10.02.26 um 23:08:
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