Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function:
- def reload_by_name(name, type):
- found = false
- modtoremove = 0
- for _mod in _modules:
- if (_mod == name):
- modtoremove = _mod
- break;
- if modtoremove != 0
- try:
- print "Reloading plugin %s" % _mod
- mod = _modules [_mod]
- print "mod, next deleting modules"
- del _modules [name]
- print "modules deleted, reloading"
- imp.reload (mod)
- print "modules reloaded"
- _modules [_mod] = mod
- print "done"
- except:
- print "Error reloading plugin %s" % _mod
- output:
- plugins enable TestPlugin
- Plugin TestPlugin has been enabled
- plugins reload TestPlugin
- Reloading plugin TestPlugin
- mod, next deleting modules
- modules deleted, reloading
- Error reloading plugin TestPlugin
- Traceback (most recent call last):
- File "S2Wrapper.py", line 476, in <module>
- PluginsManager.reload_by_name (words [2] , PluginsManager.ConsolePlugin)
- File "/home/sav/wrapper/PluginsManager.py", line 44, in reload_by_name
- for _mod in _modules:
- RuntimeError: dictionary changed size during iteration
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement