summaryrefslogtreecommitdiff
path: root/romstr.py
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
commit06174e7c2a22fe31812bf0e43e00105e01e49718 (patch)
tree4e3e15761f001bffc7f89f8760887d20a901a542 /romstr.py
parent457c03a49f6f63aeb551fecf71887b360e6c51ee (diff)
py26 fix for RomStr.load_labels (json)
original-commit-id: 9e9c37f5771c989630fa670aaafdc2ab1fdf1edf
Diffstat (limited to 'romstr.py')
-rw-r--r--romstr.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/romstr.py b/romstr.py
index 2e4db8b..d2eea44 100644
--- a/romstr.py
+++ b/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