mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 08:17:13 +03:00
Explanation comment on try/except
This commit is contained in:
parent
9ec03008ce
commit
8bb9cecfc0
5
EDMC.py
5
EDMC.py
@ -173,6 +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 twice, once with the system locale and once enforcing utf-8. If the file was made on the current
|
||||||
|
# system, chances are its the current locale, and not utf-8. Otherwise if it was copied, its probably
|
||||||
|
# utf8. Either way, try the system FIRST because reading something like cp1251 in UTF-8 results in garbage
|
||||||
|
# but the reverse results in an exception.
|
||||||
try:
|
try:
|
||||||
data = json.load(open(args.j))
|
data = json.load(open(args.j))
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user