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