Skip to content

Commit e155907

Browse files
committed
Fix logging for failed load.
1 parent 54e05d3 commit e155907

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/proxy/proxypython.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ QList<QList<QObject*>> ProxyPython::load(const PluginExtension& extension)
121121
}
122122

123123
if (extension.autodetect()) {
124-
log::error("{}: automatic plugin detection is not supported for Python plugins",
124+
log::debug("{}: automatic plugin detection is not supported for Python plugins",
125125
extension.metadata().name());
126126
return {};
127127
}

src/runner/pythonrunner.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ namespace mo2::python {
174174
// load the module
175175
auto spec =
176176
importlib_util.attr("spec_from_file_location")(name, pythonModule);
177+
178+
if (Py_IsNone(spec.ptr())) {
179+
MOBase::log::error("failed to load Python plugin '{}' from '{}'",
180+
name, pythonModule);
181+
return {};
182+
}
183+
177184
pymodule = importlib_util.attr("module_from_spec")(spec);
178185
sys.attr("modules")[py::str(name)] = pymodule;
179186
spec.attr("loader").attr("exec_module")(pymodule);

0 commit comments

Comments
 (0)