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

imp.load_source makes it hard to import build utilities #18

Open
matthewdeanmartin opened this issue Jul 17, 2018 · 0 comments
Open

imp.load_source makes it hard to import build utilities #18

matthewdeanmartin opened this issue Jul 17, 2018 · 0 comments

Comments

@matthewdeanmartin
Copy link
Collaborator

I have some functions I wanted to get out of the build.py file because they were getting bigger than the build script. I tried importing, e.g. import foo, but this line in pynt prevents it:

module = imp.load_source(path.splitext(path.basename(args.file))[0], args.file)

This is some weird loading that allows loading from pip installed, but not from code in the same directory as build.py.

The above line is also deprecated in python 3.

Here is a nasty hack to get around it.

sys.path.append(os.path.join(os.path.dirname(__file__), '.'))
from build_utils import check_is_aws, skip_if_no_change, execute_with_environment

I don't know the motivation was for using imp.load_source, but it makes pynt more difficult to use. When I get a chance I'll review navio's version & see if it has been solved there.

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