Merge pull request #801 from takluyver/py3-notebook

Gets the notebook working under Python3.
This commit is contained in:
Fernando Perez 2011-10-07 18:57:32 -07:00
commit eba1a8c796
2 changed files with 3 additions and 3 deletions

View File

@ -172,7 +172,7 @@ class ZMQStreamHandler(websocket.WebSocketHandler):
class AuthenticatedZMQStreamHandler(ZMQStreamHandler): class AuthenticatedZMQStreamHandler(ZMQStreamHandler):
def open(self, kernel_id): def open(self, kernel_id):
self.kernel_id = kernel_id self.kernel_id = kernel_id.decode('ascii')
self.session = Session() self.session = Session()
self.save_on_message = self.on_message self.save_on_message = self.on_message
self.on_message = self.on_first_message self.on_message = self.on_first_message

View File

@ -150,7 +150,7 @@ class NotebookManager(LoggingConfigurable):
raise web.HTTPError(415, u'Invalid notebook format: %s' % format) raise web.HTTPError(415, u'Invalid notebook format: %s' % format)
try: try:
nb = current.reads(data, format) nb = current.reads(data.decode('utf-8'), format)
except: except:
raise web.HTTPError(400, u'Invalid JSON data') raise web.HTTPError(400, u'Invalid JSON data')
@ -171,7 +171,7 @@ class NotebookManager(LoggingConfigurable):
raise web.HTTPError(415, u'Invalid notebook format: %s' % format) raise web.HTTPError(415, u'Invalid notebook format: %s' % format)
try: try:
nb = current.reads(data, format) nb = current.reads(data.decode('utf-8'), format)
except: except:
raise web.HTTPError(400, u'Invalid JSON data') raise web.HTTPError(400, u'Invalid JSON data')