rubys / venus

Planet Venus is an awesome ‘river of news’ feed reader. It downloads news feeds published by web sites and aggregates their content together into a single combined feed, latest news first.
http://intertwingly.net/code/venus/docs/index.html
Other
273 stars 99 forks source link

Restore __main__ module after running a plugin. #11

Open ext opened 13 years ago

ext commented 13 years ago

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.