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

Restore __main__ module after running a plugin. #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ext
Copy link
Contributor

@ext ext commented Jun 13, 2011

If the plugin raises an exception (including SystemExit) the __main__ module is
not properly loaded and it's __dict__ is lost. E.g. this causes errors when
using any global variable in planet.py. I don't think is is a good idea to keep
the plugin in memory (as __main__) anyway.

The original problem I ran into was this:

Traceback (most recent call last):
  File "/path/to/venus/planet.py", line 91, in 
    if config.pubsubhubbub_hub() and not no_publish:
AttributeError: 'NoneType' object has no attribute 'pubsubhubbub_hub'

This happened everytime a plugin (.plugin) raised an exception.

If the plugin raises an exception (including SystemExit) the __main__ module is
not properly loaded and it's __dict__ is lost. E.g. this causes errors when
using any global variable in planet.py. I don't think is is a good idea to keep
the plugin in memory (as __main__) anyway.
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.

1 participant