mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 16:27:13 +03:00
Made sure to handle non-utf8 locales
This commit is contained in:
parent
52d39dc5fd
commit
977e62188a
8
EDMC.py
8
EDMC.py
@ -173,7 +173,11 @@ sys.path: {sys.path}'''
|
||||
if args.j:
|
||||
logger.debug('Import and collate from JSON dump')
|
||||
# Import and collate from JSON dump
|
||||
data = json.load(open(args.j))
|
||||
try:
|
||||
data = json.load(open(args.j))
|
||||
except UnicodeDecodeError:
|
||||
data = json.load(open(args.j, encoding='utf-8'))
|
||||
|
||||
config.set('querytime', int(getmtime(args.j)))
|
||||
|
||||
else:
|
||||
@ -188,7 +192,7 @@ sys.path: {sys.path}'''
|
||||
logfile = join(logdir, logfiles[-1])
|
||||
|
||||
logger.debug(f'Using logfile "{logfile}"')
|
||||
with open(logfile, 'r') as loghandle:
|
||||
with open(logfile, 'r', encoding='utf-8') as loghandle:
|
||||
for line in loghandle:
|
||||
try:
|
||||
monitor.parse_entry(line)
|
||||
|
Loading…
x
Reference in New Issue
Block a user