Commit 4ddcb1b1 authored by Ben Boeckel's avatar Ben Boeckel

WIP: PythonInterpreter: dump debug info to a file

parent 2934948d
Pipeline #184352 failed with stage
......@@ -257,19 +257,25 @@ bool PythonInterpreter::canFindModule(const std::string& module) const
bool found = true;
pybind11::dict locals;
std::stringstream testCmd;
testCmd << "found = True\n"
<< "try:\n"
<< " import " << module << "\n";
testCmd << "try:\n"
" found = True\n"
" try:\n"
" import " << module << "\n";
if (Environment::hasVariable("SMTK_PYTHON_MODULE_LOAD_VERBOSE"))
{
testCmd << "except ImportError as error:\n"
<< " print(str(error))\n";
testCmd << " except ImportError as error:\n"
" print(str(error))\n";
}
else
{
testCmd << "except ImportError:\n";
testCmd << " except ImportError:\n";
}
testCmd << " found = False";
testCmd << " found = False\n";
testCmd << "except Exception as e:\n"
" import sys\n"
" import traceback\n"
" with open('/tmp/smtk.log', 'w+') as f:\n"
" traceback.print_tb(sys.last_traceback, file=f)";
pybind11::exec(testCmd.str().c_str(), pybind11::globals(), locals);
found = locals["found"].cast<bool>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment