~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/console.py

  • Committer: William Grant
  • Date: 2010-07-28 04:13:05 UTC
  • mfrom: (1801.1.2 die-cjson-die)
  • Revision ID: grantw@unimelb.edu.au-20100728041305-xwypm3cn1l1mnki1
Port from cjson to (simple)json.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
import StringIO
31
31
import uuid
32
32
 
33
 
import cjson
34
 
 
35
33
from ivle import chat, interpret
36
34
 
37
35
class ConsoleError(Exception):
190
188
            else:
191
189
                # Some other error - probably serious
192
190
                raise socket.error, (enumber, estring)
193
 
        except cjson.DecodeError:
 
191
        except ValueError:
194
192
            # Couldn't decode the JSON
195
193
            raise ConsoleError(
196
194
                "Could not understand the python console response")
249
247
 
250
248
        # Unpickle the globals
251
249
        for g in globals['globals']:
252
 
            globals['globals'][g] = cPickle.loads(globals['globals'][g])
 
250
            globals['globals'][g] = cPickle.loads(str(globals['globals'][g]))
253
251
 
254
252
        return globals['globals']
255
253
        
268
266
        # Unpickle any exceptions
269
267
        if 'exception' in call:
270
268
            call['exception']['except'] = \
271
 
                cPickle.loads(call['exception']['except'])
 
269
                cPickle.loads(str(call['exception']['except']))
272
270
 
273
271
        return call
274
272
 
280
278
              
281
279
        # Unpickle any exceptions
282
280
        if 'exception' in execute:
283
 
            execute['exception'] = cPickle.loads(execute['exception'])
 
281
            execute['exception'] = cPickle.loads(str(execute['exception']))
284
282
        return execute
285
283
 
286
284