Skip to content

Restore __main__ module after running a plugin. #11

Open
wants to merge 1 commit into from

1 participant

@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.

@ext ext Restore __main__ module after loading and running the plugin.
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.
710cf0b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.