Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-03-05 02:23:13 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-03-05 02:23:13 (GMT)
commitf2d678e4cf858499aa5585f2c1f295f005b15df9 (patch)
tree8b9b29c5a4a59df347b071571c9f9249deea615b
parent3ac757a4c37eb3b367d5e3666419a4988d2b458d (diff)
Use simplejson instead of json-py to satisfy python26
-rw-r--r--bounce.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/bounce.py b/bounce.py
index 6ace3e3..d693a0a 100644
--- a/bounce.py
+++ b/bounce.py
@@ -12,7 +12,13 @@ default_stage_descs = [
{ 'Name': _('rotate'), 'StageDepth': 160, 'StageXGravity': 0.5, 'StageYGravity': 0, 'BallSize': 1, 'BallSpeed': 5, 'PaddleWidth': 25, 'PaddleHeight': 20, 'AISpeed': 3, 'AIRecenter': 1, },
]
-import logging, os, time, math, threading, random, json, time
+import logging, os, time, math, threading, random, time
+
+try:
+ import json
+ json.dumps
+except (ImportError, AttributeError):
+ import simplejson as json
from pongc.pongc import *
@@ -1663,7 +1669,7 @@ class BounceActivity(activity.Activity):
finally:
fd.close()
- storage = json.read(data)
+ storage = json.loads(data)
# Restore stages.
game.stage_descs = storage['Stages']
@@ -1698,7 +1704,7 @@ class BounceActivity(activity.Activity):
fd = open(file_path, 'w')
try:
- fd.write(json.write(storage))
+ fd.write(json.dumps(storage))
finally:
fd.close()