[IPython-User] Running Embedded IP

Thomas Kluyver takowl@gmail....
Mon Aug 15 13:11:41 CDT 2011


On 15 August 2011 18:59, Darren Govoni <darren@ontrenet.com> wrote:

> ip = InteractiveShellEmbed()
>
> I viewed the online docs for it, but it didn't show how to do this
> programmatically.
>

To run pure Python code in the interactive namespaces, "ip.ex(code)" should
work. To run code as if it was entered at the prompt (translating magic
functions, saving as a history entry, increasing prompt count), use
"ip.run_cell(code)". In the latter case, code needs to be a string, not a
compiled code object.

There may also be a way using config to run code as the shell starts up, but
I'm not sure if that works for embedding.

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20110815/3c11a54a/attachment.html 


More information about the IPython-User mailing list