-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling IPython.embed_kernel() outside the main thread fails silently #4032
Comments
Just ran into this as well. It fails silently for me. @robo-hamburger: Can you post a bit more info on how you figured this out and how you made it work? |
I never really got cross thread kernel working. Instead a startup the kernel without the loop running to pump events and then just pump them each update in my game. This has the added benefit of the simulation being consistent but I suppose could get weird if you stopped running your own update loop. First you need a way to startup a kernel with no loop see: https://gist.github.com/robo-hamburger/6237530 Then before your start your main loop:
Once per frame/update etc: There maybe better APIs for this now but I haven't checked. I can clean this example up if you need additional help. |
Interesting. What I ended up doing that is working okay for me so far is: with mock.patch('signal.signal'):
IPython.embed_kernel(local_ns=namespace) |
I will have to remember that hack the next time I need this. |
See https://github.com/msabramo/pyramid_ipython_kernel which applies this hack to Pyramid apps. |
Seems like this should either fail loudly or more preferably work :) Right now it prints out the instructions for connecting to it with --existing but doing so does not actually work.
I dug into why this was happening a little bit and it seems like the SIG_INT wrangling can't be done which is what is blowing up. Commenting out the spots where the kernel tries to do this seems to get embed_kernel actually working.
IPython.sys_info:
{'codename': 'An Afternoon Hack',
'commit_hash': '02da31c',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path': '/usr/local/lib/python2.7/site-packages/IPython',
'ipython_version': '1.0.0',
'os_name': 'posix',
'platform': 'Darwin-12.4.0-x86_64-i386-64bit',
'sys_executable': '/usr/local/opt/python/bin/python2.7',
'sys_platform': 'darwin',
'sys_version': '2.7.5 (default, Aug 2 2013, 16:51:34) \n[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]'}
The text was updated successfully, but these errors were encountered: