[IPython-user] running ipython from command line with pysh profile does not work

Krishna Mohan Gundu gkmohan at gmail.com
Sun Apr 9 17:04:39 CDT 2006


NOTE: I accidentally missed to reply the message to the newsgroup. If
someone is looking for a solution to the problem I raised, here is
one.

> ipython -c "_ip.runlines(open('test.ipy').read())"
>
> where test.ipy is the batch file.

Thanks Ville. I dont have the current build version but I read the
ipython doc and got it to work as follows.

========runipy========
#!/usr/bin/python

from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed(['-p','pysh','-automagic'], banner = 'Entering
IPython Interpreter',
                            exit_msg = 'Exiting IPython Interpreter');
ipshell(dummy = 1);

import sys, os
if len(sys.argv) > 1 and os.path.exists(sys.argv[1]) :
  ipshell.IP.runlines(open(sys.argv[1]).read())
========runipy========

chmod 744 runipy
runipy myjob.ipy

cheers,
Krishna.




More information about the IPython-user mailing list