Skip to content

Restore __main__ module after running a plugin.#11

Open
ext wants to merge 1 commit intorubys:masterfrom
ext:master
Open

Restore __main__ module after running a plugin.#11
ext wants to merge 1 commit intorubys:masterfrom
ext:master

Conversation

@ext
Copy link
Copy Markdown
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