Skip to content

Commit 9602fbc

Browse files
[SofaPython3] Fix regression introduced in #PR182 (#252)
The python3 mecanisme used in place of python2's on is not handling pyscn by default. Declaring .pyscn in the list of sources suffix is needed to make that possible.
1 parent 483597f commit 9602fbc

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Plugin/src/SofaPython3/PythonEnvironment.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ SOFAPYTHON3_API py::module PythonEnvironment::importFromFile(const std::string&
130130
py::object globs = py::globals();
131131
if (globals == nullptr)
132132
globals = &globs;
133+
133134
py::eval<py::eval_statements>( // tell eval we're passing multiple statements
134135
"import importlib.util \n"
136+
"importlib.machinery.SOURCE_SUFFIXES.append('pyscn') \n"
135137
"spec = importlib.util.spec_from_file_location(module_name, path) \n"
136138
"new_module = importlib.util.module_from_spec(spec) \n"
137139
"spec.loader.exec_module(new_module)",

0 commit comments

Comments
 (0)