Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tautils.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-06-29 23:18:41 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-06-29 23:18:41 (GMT)
commitc491950c7febde93d98bb5998e1866f093869f1b (patch)
tree78d579f87e23c4426aceee5e71de352784690289 /TurtleArt/tautils.py
parent215e5163484d8c711bc2b983175780a66f4fcaf7 (diff)
check type returned from json_load
Diffstat (limited to 'TurtleArt/tautils.py')
-rw-r--r--TurtleArt/tautils.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index 40c39e9..d60884e 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -235,8 +235,15 @@ def data_from_file(ta_file):
def data_from_string(text):
''' JSON load data from a string. '''
- return json_load(text.replace(']],\n', ']], '))
-
+ if type(text) == str:
+ return json_load(text.replace(']],\n', ']], '))
+ else:
+ print type(text), text
+ if hasattr('replace', text):
+ return json_load(text.replace(']],\n', ']], '))
+ else:
+ print 'type error in data_from_string'
+ return ''
def data_to_file(data, ta_file):
''' Write data to a file. '''