You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
captures an ImportError that would come up if the module wasn't actually present in the directory. However, it inadvertently also handles for, say, an ImportError that would arise from the module's own logic.
this logic on its own would raise an ImportError but the trace gets effectively overridden when the module is imported somewhere else by what the logic assumes is a totally unrelated error of the module not being there in the first place.
The text was updated successfully, but these errors were encountered:
Good catch @whatisgalen and good spidy sense -- in other projects I've used from importlib.util import find_spec for exactly this kind of thing, just to sniff whether the module exists without importing. Here we could do that to finish the search loop, then with the right module in hand do the import.
this method:
captures an
ImportError
that would come up if the module wasn't actually present in the directory. However, it inadvertently also handles for, say, anImportError
that would arise from the module's own logic.For example, in
my_module.py
:this logic on its own would raise an
ImportError
but the trace gets effectively overridden when the module is imported somewhere else by what the logic assumes is a totally unrelated error of the module not being there in the first place.The text was updated successfully, but these errors were encountered: