monitor.py: Fix up legavy config.get() calls

This commit is contained in:
Athanasius committed 2021-04-12 08:31:47 +01:00
1 parent ad8c63c64c
commit 5c5e5b507e
1 file changed
+2 -2
+2 -2
View File
@@ -1157,14 +1157,14 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
oldfiles = sorted((x for x in listdir(config.get_str('outdir')) if regexp.match(x))) # type: ignore
if oldfiles:
try:
with open(join(config.get('outdir'), oldfiles[-1]), 'r', encoding='utf-8') as h: # type: ignore
with open(join(config.get_str('outdir'), oldfiles[-1]), 'r', encoding='utf-8') as h: # type: ignore
if h.read() == string:
return # same as last time - don't write
except UnicodeError:
logger.exception("UnicodeError reading old ship loadout with utf-8 encoding, trying without...")
try:
with open(join(config.get('outdir'), oldfiles[-1]), 'r') as h: # type: ignore
with open(join(config.get_str('outdir'), oldfiles[-1]), 'r') as h: # type: ignore
if h.read() == string:
return # same as last time - don't write