fix core/config.py infinite reloading loop reported by monokrome
This commit is contained in:
parent
1f84e5ded7
commit
93fbe408b5
|
@ -27,9 +27,11 @@ if not os.path.exists('config'):
|
||||||
|
|
||||||
def config():
|
def config():
|
||||||
# reload config from file if file has changed
|
# 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:
|
try:
|
||||||
bot.config = json.load(open('config'))
|
bot.config = json.load(open('config'))
|
||||||
|
bot._config_mtime = config_mtime
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
print 'ERROR: malformed config!', e
|
print 'ERROR: malformed config!', e
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue