[IPython-dev] Simple Kernel Example

Doug Blank doug.blank at gmail.com
Fri Jan 17 11:00:12 EST 2014


On Fri, Jan 17, 2014 at 10:41 AM, Matthias BUSSONNIER
<bussonniermatthias at gmail.com> wrote:
> Hi Doug,
>
> an old node kernel I wrote
>
> http://nbviewer.ipython.org/gist/Carreau/4279371/node-kernel.ipynb

Thanks! I had seen that, but missed the kernel.js file before... I see
that you have a link to that.

I figured out the issue:

> And responses to your question :
>
> Le 17 janv. 2014 à 06:36, Doug Blank a écrit :
>
>> Thanks to all for the pointers so far! I haven't gotten any of the
>> other languages to work yet (I've sent each responder a message
>> detailing what problems I am having. I'll report back here with status
>> on those fronts.)
>>
>> I see that I should be able to:
>>
>> $ ipython console
>> --KernelManager.kernel_cmd="['/path/to/simple_kernel.sh',
>> '{connection_file}']"
>>
>> where simple_kernel.sh (with chmod +x) is just a simple echo (to see
>> if it is working).
>>
>> But that gives:
>> ...
>>  File "/usr/local/lib/python2.7/dist-packages/IPython/kernel/manager.py",
>> line 161, in _launch_kernel
>>    return launch_kernel(kernel_cmd, **kw)
>>  File "/usr/local/lib/python2.7/dist-packages/IPython/kernel/launcher.py",
>> line 251, in launch_kernel
>>    stdin=_stdin, stdout=_stdout, stderr=_stderr, cwd=cwd, env=os.environ)
>>  File "/usr/lib/python2.7/subprocess.py", line 709, in __init__
>>    errread, errwrite)
>>  File "/usr/lib/python2.7/subprocess.py", line 1326, in _execute_child
>>    raise child_exception
>> OSError: [Errno 8] Exec format error
>
> Did you added the #!/bin/sh ?
>
> You can also try --KernelManager.kernel_cmd="['sh','/path/to/simple_kernel.sh', '{connection_file}']"

I traced the Python to see what the issue was, and Popen requires that
you set shell=True if you want the shell to run the cmd. But your
alternate kernel_cmd worked!

Now, to see if I can put together a simple_kernel.py or see if the
kernel.js will work...

-Doug

>>
>> I then tried to to create a profile:
>>
>> $ ipython profile create simple_kernel
>>
>> And edited ~/.config/ipython/profile_simple_kernel/ipython_config.py to include:
>> c = get_config()
>> c.Application.verbose_crash=True
>> c.InteractiveShellApp.code_to_run =
>> '/home/dblank/Desktop/IPython/simple_kernel.sh'
>
> I doubt that code_to_run what what you were looking for, here it should be `KernelManager.kernel_cmd` again.
>  --
> M
>>
>> and run:
>>
>> $ ipython console --profile simple_kernel
>>
>> But nothing happens--just runs with no output. Any suggestions about
>> what is wrong, or how to proceed?
>>
>> -Doug
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



More information about the IPython-dev mailing list