Jun-20-2020, 06:04 AM
i have this simple flask app :
but in the stdout/err Im getting :
def handle_exception(exc_type, exc_value, exc_traceback): print("Hello") dd = "test" sys.excepthook = handle_exception logger.info("a %s- b: %s" % dd) # the logger above will raise exception if __name__ == '__main__': # Start the app app.run(host='0.0.0.0', threaded=True)the handle_exception never called
but in the stdout/err Im getting :
Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1434, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/git/app/app.py", line 132, in <module> logger.info("a %s- b: %s" % dd) TypeError: not enough arguments for format stringhow to make it call the handle_exception? there i like to handle all exception that are not Were caughtאם