fix import error messages by fixing compliance with the metapath protocol. instead of always returning a module loader which errors out if it can't find a module, return None early (from find_module) if we can't find the module. this lets the system fall back to the system error handling for not-found modules.
What I did
How I did it
try importing a non-existent module with and without this patch. the results should look like:
(unpatched):
>>> import boa
>>> import asdlkfj
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/charles/titanoboa/boa/interpret.py", line 48, in load_module
raise ImportError(fullname)
ImportError: asdlkfj
>>> from requests import asldkjfasdf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/charles/titanoboa/boa/interpret.py", line 48, in load_module
raise ImportError(fullname)
ImportError: requests.asldkjfasdf
(patched):
>>> import boa
>>> import asdlkfj
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'asdlkfj'
>>> from requests import asldkjfasdf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'asldkjfasdf' from 'requests' (/home/charles/.venvs/boa/lib/python3.11/site-packages/requests/__init__.py)
How to verify it
Description for the changelog
Cute Animal Picture
![Put a link to a cute animal picture inside the parenthesis-->]()
fix import error messages by fixing compliance with the metapath protocol. instead of always returning a module loader which errors out if it can't find a module, return None early (from find_module) if we can't find the module. this lets the system fall back to the system error handling for not-found modules.
What I did
How I did it
try importing a non-existent module with and without this patch. the results should look like: (unpatched):
(patched):
How to verify it
Description for the changelog
Cute Animal Picture
![Put a link to a cute animal picture inside the parenthesis-->]()