don't shadow locals() with a variable
This commit is contained in:
parent
5c9c8704c2
commit
666a2fe3ce
6
bot.py
6
bot.py
|
@ -44,8 +44,8 @@ def reload_plugins():
|
||||||
if mtime != plugin_mtimes.get(filename):
|
if mtime != plugin_mtimes.get(filename):
|
||||||
try:
|
try:
|
||||||
code = compile(open(filename, 'U').read(), filename, 'exec')
|
code = compile(open(filename, 'U').read(), filename, 'exec')
|
||||||
locals = {}
|
namespace = {}
|
||||||
eval(code, locals)
|
eval(code, namespace)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print ' error:', e
|
print ' error:', e
|
||||||
continue
|
continue
|
||||||
|
@ -54,7 +54,7 @@ def reload_plugins():
|
||||||
for name, data in bot.plugs.iteritems():
|
for name, data in bot.plugs.iteritems():
|
||||||
bot.plugs[name] = filter(lambda x: x[0][0] != filename, data)
|
bot.plugs[name] = filter(lambda x: x[0][0] != filename, data)
|
||||||
|
|
||||||
for obj in locals.itervalues():
|
for obj in namespace.itervalues():
|
||||||
if hasattr(obj, '_skybot_hook'): #check for magic
|
if hasattr(obj, '_skybot_hook'): #check for magic
|
||||||
for type, data in obj._skybot_hook:
|
for type, data in obj._skybot_hook:
|
||||||
bot.plugs[type] += [data]
|
bot.plugs[type] += [data]
|
||||||
|
|
Loading…
Reference in New Issue