From dfe9eab817c31226e209c7be7d8d04d9a4f2608b Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Mon, 20 Nov 2023 19:43:35 +0100 Subject: [PATCH] fix 3.9/3.10 problem with traceback of last commit --- src/gui_qt/fit/fitfunction.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui_qt/fit/fitfunction.py b/src/gui_qt/fit/fitfunction.py index 204fcf3..878f166 100644 --- a/src/gui_qt/fit/fitfunction.py +++ b/src/gui_qt/fit/fitfunction.py @@ -52,12 +52,15 @@ class QFunctionWidget(QtWidgets.QWidget, Ui_Form): try: user_defined = find_models(config_paths() / 'usermodels.py') except Exception as e: - import traceback + import traceback, sys + + exc_type, exc_value, exc_traceback = sys.exc_info() + _ = QtWidgets.QMessageBox.warning( self, 'No user functions', f'Loading user-defined function failed with exception:\n' - f'{"".join(traceback.format_exception(e, limit=1))}') + f'{"".join(traceback.format_exception(exc_type, exc_value, exc_traceback, limit=1))}') logger.exception("Invalid usermodels.py", exc_info=e) for model in user_defined: