From 33fa1833923714a98b22e825bfc80ca3497dda10 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 1 Dec 2021 13:34:24 +0100 Subject: [PATCH] App: [skip ci] improve importing a Python module when passed as program argument --- src/App/Application.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 714bd83af9..67aa53a8d2 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -2631,11 +2631,12 @@ std::list Application::processFiles(const std::list& f processed.push_back(*it); } else if (file.hasExtension("py")) { - try{ + try { + Base::Interpreter().addPythonPath(file.dirPath().c_str()); Base::Interpreter().loadModule(file.fileNamePure().c_str()); processed.push_back(*it); } - catch(const PyException&) { + catch (const PyException&) { // if loading the module does not work, try just running the script (run in __main__) Base::Interpreter().runFile(file.filePath().c_str(),true); processed.push_back(*it);