diff options
Diffstat (limited to 'TurtleArt/tautils.py')
-rw-r--r-- | TurtleArt/tautils.py | 11 |
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. ''' |