From e1f1617ed7310d0be6911b8c5801f8d4cf34ac0f 2014-01-29 05:20:44 From: MinRK Date: 2014-01-29 05:20:44 Subject: [PATCH] flush output before showing tracebacks closes #3700 --- diff --git a/IPython/kernel/zmq/zmqshell.py b/IPython/kernel/zmq/zmqshell.py index 9a5f38c..c2d044b 100644 --- a/IPython/kernel/zmq/zmqshell.py +++ b/IPython/kernel/zmq/zmqshell.py @@ -501,6 +501,9 @@ class ZMQInteractiveShell(InteractiveShell): self.payload_manager.write_payload(payload) def _showtraceback(self, etype, evalue, stb): + # try to preserve ordering of tracebacks and print statements + sys.stdout.flush() + sys.stderr.flush() exc_content = { u'traceback' : stb,