[IPython-dev] Embedding IPython in C using Python/C API

Filipe Saraiva filipe at kde.org
Sun Feb 23 20:39:24 EST 2014

Thanks Fernando.

Well, I would like to start the IPython terminal from a C code, and to
use Python/C API to send the commands to processing in IPython, but when
I start IPython the terminal don't receive the codes sent by
PyRun_SimpleString. The code is here http://paste.kde.org/p8psqxtks,
easy to understand.

I am thinking in to start a IPython kernel and make the communication
using the client-server model. But, before this solution, is there any
function to IPython process a command from the python interpreter?
Anything like this, in python interpreter:

import IPython



Em 23-02-2014 19:13, Fernando Perez escreveu:
> You may want to look at the various high-level entry points here:
> http://docs.python.org/2/c-api/veryhigh.html
> It may be more convenient for you to put all the python code you'll
> need in a file and use one of the file-oriented C API functions.
> But overall, you're on the right track: IPython has no pure C API,
> only Python. So you'll need to use the functions to call Python source
> code from inside CPython.
> Cheers
> f
> On Sun, Feb 23, 2014 at 1:58 PM, Filipe Saraiva <filipe at kde.org
> <mailto:filipe at kde.org>> wrote:
>     Hello,
>     I would like to develop an IPython backend for Cantor, a IDE from
>     KDE-edu project for several mathematical softwares like Python 2,
>     Scilab, Maxima, Octave, etc. You can see the Python 2 backend info in
>     http://blog.filipesaraiva.info/?p=1213.
>     I searched for info on the web about the use of Python/C API and
>     IPython
>     but I can not find anything. I am thinking in to use
>     PyRun_SimpleString
>     to send commands to IPython and get the commands output using
>     stdout/stderr to show this outputs in C side.
>     I will appreciate any reference to use of Python/C API in IPython.
>     Thank you;
>     --
>     Filipe Saraiva
>     http://filipesaraiva.info/
>     _______________________________________________
>     IPython-dev mailing list
>     IPython-dev at scipy.org <mailto:IPython-dev at scipy.org>
>     http://mail.scipy.org/mailman/listinfo/ipython-dev
> -- 
> Fernando Perez (@fperez_org; http://fperez.org)
> fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)
> fernando.perez-at-berkeley: contact me here for any direct mail
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

Filipe Saraiva

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140223/33453fd4/attachment.html>

More information about the IPython-dev mailing list