summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-01-27 17:14:55 -0600
committerBryan Bishop <kanzure@gmail.com>2013-01-27 17:14:59 -0600
commit9e9c37f5771c989630fa670aaafdc2ab1fdf1edf (patch)
treeb25438dc44dab81be5aeed2679388e5814312deb
parentdb5208b41f8a505f68ddbccb34dca206df9ca77e (diff)
py26 fix for RomStr.load_labels (json)
-rw-r--r--extras/romstr.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/extras/romstr.py b/extras/romstr.py
index 2e4db8b5b..d2eea44ae 100644
--- a/extras/romstr.py
+++ b/extras/romstr.py
@@ -4,9 +4,13 @@ import sys
import os
import time
import datetime
-import json
from ctypes import c_int8
from copy import copy
+import json
+
+# New versions of json don't have read anymore.
+if not hasattr(json, "read"):
+ json.read = json.loads
from labels import (
get_label_from_line,
@@ -100,7 +104,7 @@ class RomStr(str):
file_handler.close()
# load the labels from the file
- self.labels = json.loads(open(filename, "r").read())
+ self.labels = json.read(open(filename, "r").read())
def get_address_for(self, label):
""" Returns the address of a label. This is slow and could be improved