mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-16 15:22:17 +03:00
monitor.py: Fix up legavy config.get() calls
This commit is contained in:
parent
ad8c63c64c
commit
5c5e5b507e
@ -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
|
oldfiles = sorted((x for x in listdir(config.get_str('outdir')) if regexp.match(x))) # type: ignore
|
||||||
if oldfiles:
|
if oldfiles:
|
||||||
try:
|
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:
|
if h.read() == string:
|
||||||
return # same as last time - don't write
|
return # same as last time - don't write
|
||||||
|
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
logger.exception("UnicodeError reading old ship loadout with utf-8 encoding, trying without...")
|
logger.exception("UnicodeError reading old ship loadout with utf-8 encoding, trying without...")
|
||||||
try:
|
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:
|
if h.read() == string:
|
||||||
return # same as last time - don't write
|
return # same as last time - don't write
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user