Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions src/routing/Routing_Py_Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,15 @@ Routing_Py_Adapter::Routing_Py_Adapter(std::string t_route_config_file_with_path
t_route_config_path(t_route_config_file_with_path){
//hold a reference to the interpreter, ensures an interpreter exists as long as the reference is held
interpreter = utils::ngenPy::InterpreterUtil::getInstance();
//Import ngen_main. Will throw error if module isn't available
//in the embedded interpreters PYTHON_PATH
// Import the routing module. An error will be thrown if module isn't available
// in the embedded interpreters PYTHON_PATH
try {
this->t_route_module = utils::ngenPy::InterpreterUtil::getPyModule("ngen_routing.ngen_main");
LOG("Legacy t-route module detected; use of this version is deprecated!", LogLevel::WARNING);
this->t_route_module = utils::ngenPy::InterpreterUtil::getPyModule("nwm_routing.__main__");
LOG("Routing module nwm_routing.__main__ detected and used.", LogLevel::INFO);
}
catch (const pybind11::error_already_set& e){
try {
// The legacy module has a `nwm_routing.__main__`, so we have to try this one second!
this->t_route_module = utils::ngenPy::InterpreterUtil::getPyModule("nwm_routing.__main__");
LOG("Legacy t-route module nwm_routing.__main__ detected and used.", LogLevel::DEBUG);
}
catch (const pybind11::error_already_set& e){
LOG("Unable to import a supported routing module.", LogLevel::FATAL);
throw e;
}
catch (const pybind11::error_already_set& e) {
LOG("Unable to import a supported routing module.", LogLevel::FATAL);
throw e;
}
}

Expand Down
Loading