diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-03-05 02:17:47 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-03-05 02:17:47 (GMT) |
commit | 69d7246513000a88bd903f3cf16497c1d5f9ff91 (patch) | |
tree | 29cd49b0ac5c08503241e0b6e8f073a50c3d0c0f /document.py | |
parent | a003ca0fa671f5424c9ce1baa0d15ddcaff6db35 (diff) |
Use simplejson instead of cjson
Diffstat (limited to 'document.py')
-rw-r--r-- | document.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/document.py b/document.py index 9273f2c..d3ba739 100644 --- a/document.py +++ b/document.py @@ -14,9 +14,14 @@ import os import gtk -import cjson from zipfile import ZipFile +try: + import json + json.dumps +except (ImportError, AttributeError): + import simplejson as json + import theme from sound import * from ground import * @@ -70,7 +75,7 @@ def save(filepath): node['index'] = i cfg['tape'].append(node) - zip.writestr('MANIFEST', cjson.encode(cfg)) + zip.writestr('MANIFEST', json.dumps(cfg)) zip.close() import shutil @@ -78,7 +83,7 @@ def save(filepath): def load(filepath): zip = ZipFile(filepath, 'r') - cfg = cjson.decode(zip.read('MANIFEST')) + cfg = json.loads(zip.read('MANIFEST')) def _load(node, restored_class, preinstalled_class): if node['custom']: |