Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out load_lib() package-related behavior #4

Open
natezb opened this issue Aug 7, 2017 · 0 comments
Open

Figure out load_lib() package-related behavior #4

natezb opened this issue Aug 7, 2017 · 0 comments
Assignees

Comments

@natezb
Copy link
Collaborator

natezb commented Aug 7, 2017

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.

@natezb natezb self-assigned this Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant