##// END OF EJS Templates
use IPython traceback formatting in apply requests
MinRK -
Show More
@@ -530,8 +530,9 b' class Kernel(Configurable):'
530 530 return
531 531
532 532 # Set the parent message of the display hook and out streams.
533 self.shell.displayhook.set_parent(parent)
534 self.shell.display_pub.set_parent(parent)
533 shell = self.shell
534 shell.displayhook.set_parent(parent)
535 shell.display_pub.set_parent(parent)
535 536 sys.stdout.set_parent(parent)
536 537 sys.stderr.set_parent(parent)
537 538
@@ -540,7 +541,7 b' class Kernel(Configurable):'
540 541 # self.session.send(self.iopub_socket, u'pyin', {u'code':code},parent=parent)
541 542 sub = self._make_subheader()
542 543 try:
543 working = self.shell.user_ns
544 working = shell.user_ns
544 545
545 546 prefix = "_"+str(msg_id).replace("-","")+"_"
546 547
@@ -558,7 +559,7 b' class Kernel(Configurable):'
558 559 working.update(ns)
559 560 code = "%s = %s(*%s,**%s)" % (resultname, fname, argname, kwargname)
560 561 try:
561 exec code in self.shell.user_global_ns, self.shell.user_ns
562 exec code in shell.user_global_ns, shell.user_ns
562 563 result = working.get(resultname)
563 564 finally:
564 565 for key in ns.iterkeys():
@@ -567,14 +568,23 b' class Kernel(Configurable):'
567 568 packed_result,buf = serialize_object(result)
568 569 result_buf = [packed_result]+buf
569 570 except:
570 exc_content = self._wrap_exception('apply')
571 # exc_msg = self.session.msg(u'pyerr', exc_content, parent)
572 self.session.send(self.iopub_socket, u'pyerr', exc_content, parent=parent,
571 # invoke IPython traceback formatting
572 shell.showtraceback()
573 # FIXME - fish exception info out of shell, possibly left there by
574 # run_code. We'll need to clean up this logic later.
575 reply_content = {}
576 if shell._reply_content is not None:
577 reply_content.update(shell._reply_content)
578 e_info = dict(engine_uuid=self.ident, engine_id=self.int_id, method='apply')
579 reply_content['engine_info'] = e_info
580 # reset after use
581 shell._reply_content = None
582
583 self.session.send(self.iopub_socket, u'pyerr', reply_content, parent=parent,
573 584 ident=self._topic('pyerr'))
574 reply_content = exc_content
575 585 result_buf = []
576 586
577 if exc_content['ename'] == 'UnmetDependency':
587 if reply_content['ename'] == 'UnmetDependency':
578 588 sub['dependencies_met'] = False
579 589 else:
580 590 reply_content = {'status' : 'ok'}
General Comments 0
You need to be logged in to leave comments. Login now