diff --git a/src/proxy/plugin_python_en.ts b/src/proxy/plugin_python_en.ts index 142f2b9..9d484bb 100644 --- a/src/proxy/plugin_python_en.ts +++ b/src/proxy/plugin_python_en.ts @@ -4,58 +4,70 @@ ProxyPython - + + Python Initialization failed + + + + + On a previous start the Python Plugin failed to initialize. +Do you want to try initializing python again (at the risk of another crash)? + Suggestion: Select "no", and click the warning sign for further help.Afterwards you have to re-enable the python plugin. + + + + Python Proxy - + Proxy Plugin to allow plugins written in python to be loaded - + ModOrganizer path contains a semicolon - + Python DLL not found - + Invalid Python DLL - + Initializing Python failed - - + + invalid problem key %1 - + The path to Mod Organizer (%1) contains a semicolon. <br>While this is legal on NTFS drives, many softwares do not handle it correctly.<br>Unfortunately MO depends on libraries that seem to fall into that group.<br>As a result the python plugin cannot be loaded, and the only solution we canoffer is to remove the semicolon or move MO to a path without a semicolon. - + The Python plugin DLL was not found, maybe your antivirus deleted it. Re-installing MO2 might fix the problem. - + The Python plugin DLL is invalid, maybe your antivirus is blocking it. Re-installing MO2 and adding exclusions for it to your AV might fix the problem. - + The initialization of the Python plugin DLL failed, unfortunately without any details. diff --git a/src/runner/pythonutils.cpp b/src/runner/pythonutils.cpp index 5e7e900..5361722 100644 --- a/src/runner/pythonutils.cpp +++ b/src/runner/pythonutils.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include "log.h" @@ -67,8 +68,18 @@ namespace mo2::python { sys.attr("stdout") = printWrapper(); sys.attr("stderr") = errorWrapper(); - // not sure if still needed for pybind11? - sys.attr("excepthook") = sys.attr("__excepthook__"); + // this is required to handle exception in Python code OUTSIDE of pybind11 call, + // typically on Qt classes with methods overridden on the Python side + // + // without this, the application will crash instead of properly handling the + // exception as it would do with a py::error_already_set{} + // + // IMPORTANT: sys.attr("excepthook") = sys.attr("__excepthook__") DOES NOT WORK, + // and I have no clue why since the attribute does not seem to get updated (at + // least a print does not show it) + // + sys.attr("excepthook") = + py::eval("lambda x, y, z: sys.__excepthook__(x, y, z)"); } // Small structure to hold the levels - There are copy paste from