Be flexible where simplejson comes from
This commit is contained in:
@@ -25,11 +25,20 @@ import httplib2
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import simplejson
|
|
||||||
import uritemplate
|
import uritemplate
|
||||||
import urllib
|
import urllib
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
|
try:
|
||||||
|
import simplejson
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
# Try to import from django, should work on App Engine
|
||||||
|
from django.utils import simplejson
|
||||||
|
except ImportError:
|
||||||
|
# Should work for Python2.6 and higher.
|
||||||
|
import json as simplejson
|
||||||
|
|
||||||
|
|
||||||
class HttpError(Exception):
|
class HttpError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -23,9 +23,19 @@ __author__ = 'jcgregorio@google.com (Joe Gregorio)'
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import simplejson
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
try:
|
||||||
|
import simplejson
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
# Try to import from django, should work on App Engine
|
||||||
|
from django.utils import simplejson
|
||||||
|
except ImportError:
|
||||||
|
# Should work for Python2.6 and higher.
|
||||||
|
import json as simplejson
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
for filename in sys.argv[1:]:
|
for filename in sys.argv[1:]:
|
||||||
f = file(filename, "r")
|
f = file(filename, "r")
|
||||||
@@ -49,4 +59,3 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user