fix core/config.py infinite reloading loop reported by monokrome

This commit is contained in:
Ryan Hitchman 2010-08-22 17:24:57 -05:00
parent 1f84e5ded7
commit 93fbe408b5
1 changed files with 3 additions and 1 deletions

View File

@ -27,9 +27,11 @@ if not os.path.exists('config'):
def config():
# reload config from file if file has changed
if bot._config_mtime != os.stat('config').st_mtime:
config_mtime = os.stat('config').st_mtime
if bot._config_mtime != config_mtime:
try:
bot.config = json.load(open('config'))
bot._config_mtime = config_mtime
except ValueError, e:
print 'ERROR: malformed config!', e