-
Notifications
You must be signed in to change notification settings - Fork 21
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
Module generator bug fixed to correctly import Custom files #348
Module generator bug fixed to correctly import Custom files #348
Conversation
The problem is that adding this dot in front of the imported module breaks modules if running them directly. Like this:
|
Let me test if I face the same issue. I don't think I have directly run the |
@thjsal I have pushed another commit to account for relative imports. |
xpsi/module_generator.py
Outdated
'''.format(args.custom_background_module) | ||
) | ||
elif args.background_shared_class: | ||
for _instrument in args.instruments: | ||
module += ( | ||
''' | ||
from {0} import {1}_CustomBackground | ||
if __name__ == '__main__': | ||
from .{0} import {1}_CustomBackground |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably no dot should be here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And actually, it probably should be:
if __name__ == '__main__':
from {0} import {1}_CustomBackground
'''.format(args.custom_background_module,
_instrument)
else:
from .{0} import {1}_CustomBackground
'''.format(args.custom_background_module,
_instrument)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes that's correct. The else
condition is fine in the commit. The if
condition has the typo that you caught
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a commit to fix that.
No description provided.