Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/taproject.py
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2009-03-05 02:00:45 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2009-03-05 02:00:45 (GMT)
commit9d9cbd594e02c12d0fe883c77afbd1d325ce922c (patch)
tree130f23aea8e5b3d1e9ba0e48fbd98ffbfd8f6956 /taproject.py
parent0927ca0ab2d41764ef04d03ccd72e4f21e2479be (diff)
simplejson
Diffstat (limited to 'taproject.py')
-rw-r--r--taproject.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/taproject.py b/taproject.py
index 70d7175..b7ff1a2 100644
--- a/taproject.py
+++ b/taproject.py
@@ -22,7 +22,12 @@ import pygtk
pygtk.require('2.0')
import gtk
import pickle
-import cjson
+#import cjson
+try:
+ import json
+ json.dumps
+except (ImportError, AttributeError):
+ import simplejson as json
import os.path
from tasprites import *
@@ -52,7 +57,8 @@ def load_files(tw,ta_file, png_file=''):
# print "reading saved json data"
f.seek(0) # rewind necessary because of pickle.load
text = f.read()
- listdata = cjson.decode(text)
+# listdata = cjson.decode(text)
+ listdata = json.decode(text)
data = tuplify(listdata) # json converts tuples to lists
f.close()
new_project(tw)
@@ -74,7 +80,8 @@ def get_load_name(tw):
# unpack serialized data sent across a share
def load_string(tw,text):
- listdata = cjson.decode(text)
+# listdata = cjson.decode(text)
+ listdata = json.decode(text)
data = tuplify(listdata) # json converts tuples to lists
new_project(tw)
read_data(tw,data)
@@ -169,7 +176,8 @@ def get_save_name(tw):
def save_data(tw,fname):
f = file(fname, "w")
data = assemble_data_to_save(tw)
- text = cjson.encode(data)
+# text = cjson.encode(data)
+ text = json.encode(data)
f.write(text)
f.close()
@@ -177,7 +185,8 @@ def save_data(tw,fname):
def save_string(tw):
data = assemble_data_to_save(tw)
# encode it for sending across the network
- text = cjson.encode(data)
+# text = cjson.encode(data)
+ text = json.encode(data)
return text
def assemble_data_to_save(tw):