<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello Michele,</p>
    <p>thanks for the report! I've implemented the new debug_monitor and
      did some first investigations.</p>
    <p>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</p>
    <p>app.run(debug=True, threaded=False, passthrough_errors=True,
      use_debugger=False, use_reloader=False)</p>
    <p>I hope this helps for the moment.</p>
    <p>Tobias</p>
    <div class="moz-cite-prefix">Michele Petrazzo schrieb am 09.02.26 um
      11:25:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAGp2FGVFBr8e_h-BLDWpH+YNAxy9yx+J_NTDC=zw-sUTsujHEQ@mail.gmail.com">
      <div dir="ltr">
        <div>Hello,</div>
        <div>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.</div>
        <div>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: <a
href="https://flask.palletsprojects.com/en/stable/debugging/"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://flask.palletsprojects.com/en/stable/debugging/</a></div>
        <div><br>
        </div>
        <div>But:</div>
        <div>- 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")</div>
        <div>- 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</div>
        <div>- with Flask reload disabled without Eric breakpoint and
          without errors, all goes well, but with breakpoints or errors:</div>
        <div><br>
        </div>
        <div><i>  File
"/opt/eric_ide/eric_env/lib/python3.13/site-packages/eric7/DebugClients/Python/../../../flask/app.py",
            line 865, in dispatch_request<br>
                return
            self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
             # type: ignore[no-any-return]<br>
                     
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^<br>
              File
"/opt/eric_ide/eric_env/lib/python3.13/site-packages/eric7/DebugClients/Python/debug_monitor.py",
            line 372, in __monitor_exception<br>
                self.user_exception(excinfo, False)<br>
                ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^<br>
              File
"/opt/eric_ide/eric_env/lib/python3.13/site-packages/eric7/DebugClients/Python/debug_monitor.py",
            line 1091, in user_exception<br>
                current_thread = self._dbgClient.threads[thread_id]<br>
                                 ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^<br>
            KeyError: 133533733566144</i></div>
        <div><br>
        </div>
        <div>Without "report all exceptions":</div>
        <div><br>
        </div>
        <div><i>    return
            self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
             # type: ignore[no-any-return]<br>
                     
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^<br>
              File "/home/devel/flasktest/app.py", line 11, in error<br>
                e = 1/0<br>
                    ~^~<br>
            ZeroDivisionError: division by zero</i></div>
        <div><br>
        </div>
        <div>I have eric and flask just installed with a fresh env and
          pip.</div>
        <div><br>
        </div>
        <div>Now I have ended my ideas, so someone has tried and has a
          working configurations with Eric and Flask?</div>
        <div><br>
        </div>
        <div>Thansk a lot,</div>
        <div>Michele</div>
        <div><br>
        </div>
        <div>Simplest Flask app:</div>
        <div>(venv) pip install Flask</div>
        <div><br>
        </div>
        <div><app.py></div>
        <div>from flask import Flask<br>
          <br>
          app = Flask(__name__)<br>
          <br>
          @app.route("/")<br>
          def home():<br>
              return "Hello, Flask!"<br>
          <br>
          @app.route("/error")<br>
          def error():<br>
              e = 1/0<br>
              return e<br>
          <br>
          if __name__ == "__main__":<br>
              app.run(debug=True)</div>
        <div>    # app.run( debug=True, passthrough_errors=True,
          use_debugger=False, use_reloader=False) -> try any of this
          combination<br>
          )<br>
          <br>
        </div>
        <div># python app.py</div>
        <div>open web browser on <a href="http://127.0.0.1:5000"
            moz-do-not-send="true" class="moz-txt-link-freetext">http://127.0.0.1:5000</a>
          and after try <a href="http://127.0.0.1:5000/error"
            moz-do-not-send="true" class="moz-txt-link-freetext">http://127.0.0.1:5000/error</a></div>
      </div>
    </blockquote>
  </body>
</html>