[IPython-user] non-interactive ipython for script
Ville M. Vainio
Tue Dec 11 10:23:03 CST 2007
On Dec 10, 2007 10:37 PM, Reckoner <firstname.lastname@example.org> wrote:
> I managed to resolve my own dilemma. For posterity, I'm going to record the
> solution to my dilemma here:
> If you want to run ipython commands within a python script you need to do
> something like
> from IPython.Shell import IPShellEmbed
> ipshell = IPShellEmbed()
> and then if you have _ipmagic commands you want to run, you can do
> ip.ipmagic("px import os")
Note that it's more rebust to run methods on the public IPython api.
I.e. do ip = ipshell.api and then ip.magic('px import os')
You can explore the api interactively by playing with _ip object.
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
More information about the IPython-user