Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A race condition in IPython under Mac OS Darwin. iopub.get_msg fails unless sleep(1) is uncommented.
from IPython.kernel import KernelManager
from time import sleep
def racecondition():
km = KernelManager()
km.start_kernel()
kc = km.client()
kc.start_channels()
iopub = kc.iopub_channel
shell = kc.shell_channel
#sleep(1)
shell.execute('print "hello world"')
print shell.get_msg(timeout=1)
print iopub.get_msg(timeout=1)
if __name__ == '__main__':
racecondition()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment