projects
/
jansson.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
04d550b
)
test/json-compare.py: Use json module from Python >=2.6 or simplejson
author
Petri Lehtinen
<petri@digip.org>
Fri, 11 Sep 2009 19:22:34 +0000
(22:22 +0300)
committer
Petri Lehtinen
<petri@digip.org>
Fri, 11 Sep 2009 19:22:34 +0000
(22:22 +0300)
test/json-compare.py
patch
|
blob
|
history
diff --git
a/test/json-compare.py
b/test/json-compare.py
index
1db93da
..
f91530e
100755
(executable)
--- a/
test/json-compare.py
+++ b/
test/json-compare.py
@@
-5,8
+5,11
@@
# Jansson is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
# Jansson is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
-import simplejson
import sys
import sys
+try:
+ import json
+except ImportError:
+ import simplejson as json
def load(filename):
try:
def load(filename):
try:
@@
-17,14
+20,14
@@
def load(filename):
sys.exit(1)
try:
sys.exit(1)
try:
- json
= simple
json.load(jsonfile)
+ json
data =
json.load(jsonfile)
except ValueError, err:
print "%s is malformed: %s" % (filename, err)
sys.exit(1)
finally:
jsonfile.close()
except ValueError, err:
print "%s is malformed: %s" % (filename, err)
sys.exit(1)
finally:
jsonfile.close()
- return json
+ return json
data
def main():
if len(sys.argv) != 3:
def main():
if len(sys.argv) != 3: