[IPython-User] running "ipython myscript.py"

Paul Ivanov pivanov314@gmail....
Wed Mar 9 03:36:28 CST 2011


Alan Wilter Sousa da Silva, on 2011-03-08 11:30,  wrote:
> Hi there,
> 
> I have an script in ipython with things like:
> 
>     head = !grep '^>' ${tax}*.fasta
>     gen = [line.split()[1].split(':')[1] for line in head]
> 
> But if doing in bash terminal:
> 
> > ipython myscript.py
> 
> I got this error:
> 
>    File "myscript.py", line 85
>      head = !grep '^>' ${tax}*.fasta
>             ^
> SyntaxError: invalid syntax
> 
> WARNING: Failure executing file: <myscript.py>
> 
> How to go around it?

Hi Alan,

rename your file to .ipy

If the file ends with .ipy, you can launch it by
"ipython myscript.ipy" and all the commands are parsed like they
were executed directly in the command line (i.e. they can contain
%magic's and other special ipython directives, which was not the
case previously).
 
best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://mail.scipy.org/pipermail/ipython-user/attachments/20110309/0031555f/attachment.bin 


More information about the IPython-User mailing list