diff --git a/src/proxy/proxypython.cpp b/src/proxy/proxypython.cpp index f8d244e..3e4ade4 100644 --- a/src/proxy/proxypython.cpp +++ b/src/proxy/proxypython.cpp @@ -121,7 +121,7 @@ QList> ProxyPython::load(const PluginExtension& extension) } if (extension.autodetect()) { - log::error("{}: automatic plugin detection is not supported for Python plugins", + log::debug("{}: automatic plugin detection is not supported for Python plugins", extension.metadata().name()); return {}; } diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index b959134..006214d 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -174,6 +174,13 @@ namespace mo2::python { // load the module auto spec = importlib_util.attr("spec_from_file_location")(name, pythonModule); + + if (Py_IsNone(spec.ptr())) { + MOBase::log::error("failed to load Python plugin '{}' from '{}'", + name, pythonModule); + return {}; + } + pymodule = importlib_util.attr("module_from_spec")(spec); sys.attr("modules")[py::str(name)] = pymodule; spec.attr("loader").attr("exec_module")(pymodule);