~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-27 09:02:06 UTC
  • mto: This revision was merged to the branch mainline in revision 1824.
  • Revision ID: grantw@unimelb.edu.au-20100727090206-pmf5j6lu6xc892q8
Replace semester.semester with semester.{code,url_name,display_name}.

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