Open gerritdm opened 4 years ago
Any suggestions for how to fix this?
I think the easiest solution would be to simply clarify the error message and say something like:
"ERROR! Subtype module " + m + " could not be imported. Possible causes: module does not exist, module has syntax errors, ..."
(I'm sure there are more possible causes)
I'm not sure if it's possible but a more advanced solution could be to try and catch the errors separately so you would differentiate between an error arising from trying to import a non-existing module vs. a syntax error within the module you're trying to import
Just a note that we catch the ImportError a number of places in the code (it's all over the place in the testing suite), so it probably makes sense to think about a more general refactor.
load_subtype_modules
in gridpath.auxiliary.auxiliary
Right now, the
load_subtype_modules()
function in auxiliary.py will print the following message when the import fails, regardless of the cause:"ERROR! Subtype module gen_commit_bin not found.”
This can be misleading when the cause is actually a syntax error or something else within the module being imported, rather than an issue with finding the module.