1
0
forked from IPKM/nmreval

fix 3.9/3.10 problem with traceback of last commit

This commit is contained in:
Dominik Demuth 2023-11-20 19:43:35 +01:00
parent d18b3ee671
commit dfe9eab817

View File

@ -52,12 +52,15 @@ class QFunctionWidget(QtWidgets.QWidget, Ui_Form):
try: try:
user_defined = find_models(config_paths() / 'usermodels.py') user_defined = find_models(config_paths() / 'usermodels.py')
except Exception as e: except Exception as e:
import traceback import traceback, sys
exc_type, exc_value, exc_traceback = sys.exc_info()
_ = QtWidgets.QMessageBox.warning( _ = QtWidgets.QMessageBox.warning(
self, self,
'No user functions', 'No user functions',
f'Loading user-defined function failed with exception:\n' 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) logger.exception("Invalid usermodels.py", exc_info=e)
for model in user_defined: for model in user_defined: