mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Fix logging for failed load.
This commit is contained in:
@@ -121,7 +121,7 @@ QList<QList<QObject*>> 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 {};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user