@@ -269,9 +269,10 @@ def on_message(self, msg):
269269
270270 def _on_zmq_reply (self , stream , msg_list ):
271271 idents , fed_msg_list = self .session .feed_identities (msg_list )
272+ msg = self .session .deserialize (fed_msg_list )
273+ parent = msg ['parent_header' ]
272274 def write_stderr (error_message ):
273275 self .log .warn (error_message )
274- parent = json .loads (fed_msg_list [2 ])
275276 msg = self .session .msg ("stream" ,
276277 content = {"text" : error_message , "name" : "stderr" },
277278 parent = parent
@@ -280,7 +281,7 @@ def write_stderr(error_message):
280281 self .write_message (json .dumps (msg , default = date_default ))
281282
282283 channel = getattr (stream , 'channel' , None )
283- msg_type = json . loads ( fed_msg_list [ 1 ]) ['msg_type' ]
284+ msg_type = msg [ 'header' ] ['msg_type' ]
284285 if channel == 'iopub' and msg_type not in {'status' , 'comm_open' , 'execute_input' }:
285286
286287 # Remove the counts queued for removal.
@@ -345,7 +346,7 @@ def write_stderr(error_message):
345346 # If either of the limit flags are set, do not send the message.
346347 if self ._iopub_msgs_exceeded or self ._iopub_data_exceeded :
347348 return
348- super (ZMQChannelsHandler , self )._on_zmq_reply (stream , msg_list )
349+ super (ZMQChannelsHandler , self )._on_zmq_reply (stream , msg )
349350
350351
351352 def on_close (self ):
0 commit comments