avoid race condition when creating directories
[mygpo.git] / mygpo / json.py
blob0232c3313d43c54c57d32326f0f1ccccaad0dc56
2 # Tries to import the best JSON module available
5 import sys
8 try:
9 # UltraJSON should be the fastest
10 # get it from
11 # https://github.com/esnme/ultrajson
12 # http://pypi.python.org/pypi/ujson/
13 import ujson as json
14 JSONDecodeError = ValueError
16 except:
17 print >> sys.stderr, 'ujson not found'
19 try:
20 # If SimpleJSON is installed separately, it might be a recent version
21 import simplejson as json
22 JSONDecodeError = json.JSONDecodeError
24 except:
25 print >> sys.stderr, 'simplejson not found'
27 # Otherwise use json from the stdlib
28 import json
29 JSONDecodeError = ValueError