Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tautils.py
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt/tautils.py')
-rw-r--r--TurtleArt/tautils.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index d60884e..e24d061 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -237,13 +237,12 @@ def data_from_string(text):
''' JSON load data from a string. '''
if type(text) == str:
return json_load(text.replace(']],\n', ']], '))
+ elif type(text) == unicode:
+ text = text.encode('ascii', 'replace')
+ 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 ''
+ print 'type error (%s) in data_from_string' % (type(text))
+ return None
def data_to_file(data, ta_file):
''' Write data to a file. '''