Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Ben Boeckel
SMTK
Commits
4ddcb1b1
Commit
4ddcb1b1
authored
Aug 11, 2020
by
Ben Boeckel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: PythonInterpreter: dump debug info to a file
parent
2934948d
Pipeline
#184352
failed with stage
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
smtk/common/PythonInterpreter.cxx
smtk/common/PythonInterpreter.cxx
+13
-7
No files found.
smtk/common/PythonInterpreter.cxx
View file @
4ddcb1b1
...
...
@@ -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
>
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment