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 .logger import setup_logging
from .offlinequeue import Queue from .offlinequeue import Queue
from .packages import argparse from .packages import argparse
from .packages import simplejson as json
from .packages.requests.exceptions import RequestException from .packages.requests.exceptions import RequestException
from .project import get_project_info from .project import get_project_info
from .session_cache import SessionCache from .session_cache import SessionCache
from .stats import get_file_stats from .stats import get_file_stats
try:
from .packages import simplejson as json
except (ImportError, SyntaxError):
import json
try: try:
from .packages import tzlocal from .packages import tzlocal
except: # pragma: nocover except: # pragma: nocover

View file

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