diff --git a/wakatime/base.py b/wakatime/base.py index ee1419a..3270557 100644 --- a/wakatime/base.py +++ b/wakatime/base.py @@ -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 diff --git a/wakatime/logger.py b/wakatime/logger.py index 2dc453e..2ec303f 100644 --- a/wakatime/logger.py +++ b/wakatime/logger.py @@ -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):