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
Currently load_lib() relies on being passed a pkg argument, typically the __package__ attribute of the file from which it's being called. However, this is the empty string for standalone modules. Currently, this results in a confusing error message coming from importlib.import_module():
TypeError: the 'package' argument is required to perform a relative import for '._mylib'.
Maybe it doesn't make sense to allow use of load_lib() by non-packages, because there's the generated _mylib.py file and maybe a _build_mylib.py too. However, if this is the case, we should provide an error message that makes this clear, and probably a note about this in the docs somewhere.
We may also want to provide a way for the user to modify where load_lib() looks for the generated files.
The text was updated successfully, but these errors were encountered:
Currently
load_lib()
relies on being passed apkg
argument, typically the__package__
attribute of the file from which it's being called. However, this is the empty string for standalone modules. Currently, this results in a confusing error message coming fromimportlib.import_module()
:Maybe it doesn't make sense to allow use of
load_lib()
by non-packages, because there's the generated_mylib.py
file and maybe a_build_mylib.py
too. However, if this is the case, we should provide an error message that makes this clear, and probably a note about this in the docs somewhere.We may also want to provide a way for the user to modify where
load_lib()
looks for the generated files.The text was updated successfully, but these errors were encountered: