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

remove newly imported modules after script execution #103

Merged
merged 1 commit into from
Oct 9, 2017

Conversation

fragmuffin
Copy link
Contributor

addresses issue #102

@jmwright
Copy link
Owner

jmwright commented Oct 9, 2017

Thanks!

@jmwright jmwright merged commit 90668e3 into jmwright:master Oct 9, 2017
@fragmuffin
Copy link
Contributor Author

Hmm... just a "heads up", it's possible this has introduced a bug.

It occurred for me when I still had the logging stuff in my cqparts library in the __init__.py file.
I spent an hour on it and couldn't figure out what the problem was

Symptom
Script runs correctly the first time, but when it's run a second time it throws an exception.
For me, the exception was raised on code similar to...

import logging

print("IMPORTED: %s" % __name__)

def do_stuff(errlevel, msg):
    if errlevel >= logging.ERROR:
        print(msg)
  1. when run the first time, it would work, and "IMPORTED" was printed
  2. on the second run, "IMPORTED" was printed, so the assumption is logging was imported, but the if line raised:
AttributeError: 'NoneType' object has no attribute 'ERROR'

After an hour of scratching my head, even using rpdb to debug, and things still didn't make any sense.
I ended up removing the duplicated logging code from my library, and it's been behaving beautifully ever since.

  • Likelyhood : LOW
  • Impact : HIGH

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

Successfully merging this pull request may close these issues.

None yet

2 participants