fallback to builtin json module when importing simplejson fails

This commit is contained in:
Alan Hamlett 2015-08-11 13:52:14 -07:00
parent 337e4bae5b
commit 7b4711ad54
2 changed files with 8 additions and 2 deletions

View File

@ -33,11 +33,14 @@ from .compat import u, open, is_py3
from .logger import setup_logging
from .offlinequeue import Queue
from .packages import argparse
from .packages import simplejson as json
from .packages.requests.exceptions import RequestException
from .project import get_project_info
from .session_cache import SessionCache
from .stats import get_file_stats
try:
from .packages import simplejson as json
except (ImportError, SyntaxError):
import json
try:
from .packages import tzlocal
except: # pragma: nocover

View File

@ -13,12 +13,15 @@ import logging
import os
import sys
from .packages import simplejson as json
from .compat import u
try:
from collections import OrderedDict
except ImportError:
from .packages.ordereddict import OrderedDict
try:
from .packages import simplejson as json
except (ImportError, SyntaxError):
import json
class CustomEncoder(json.JSONEncoder):