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
Traceback (most recent call last):
File "C:\Users\ducks\Source\ducktools-lazyimporter\scratch\example.py", line 6, in <module>
with capture_imports(laz, auto_export=False):
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ducks\Source\ducktools-lazyimporter\src\ducktools\lazyimporter\capture.py", line 236, in __exit__
capture = importer_map[attrib_name]
~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'unittest'
This is because the name in the global namespace isn't the submodule, it's the initial parent import.
The importer map is constructed based on the final element, so an "as" import can work backwards to the original import.
If the imports are reversed, there is currently no error - but the submodule doesn't work as the module import overwrote the submodule import in the globals namespace.
The text was updated successfully, but these errors were encountered:
Currently in the tracing back, a submodule import without an assigned name will trigger a keyerror as it fails to be traced backwards.
Errors as:
This is because the name in the global namespace isn't the submodule, it's the initial parent import.
The importer map is constructed based on the final element, so an "as" import can work backwards to the original import.
If the imports are reversed, there is currently no error - but the submodule doesn't work as the module import overwrote the submodule import in the globals namespace.
The text was updated successfully, but these errors were encountered: