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

Alan Wilter Sousa da Silva awilter@ebi.ac...
Wed Mar 9 05:45:54 CST 2011


Thanks Paul,

And how to make my script executable? I mean I tried to put in my test.ipy:

#!/sw/arch/bin/ipython

then:

chmod +x test.ipy

but

./test.ipy

won't work.

Alan

On 9 March 2011 09:36, Paul Ivanov <pivanov314@gmail.com> wrote:

> 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
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAk13ShAACgkQe+cmRQ8+KPfOXACfen9biGmFban66HjDXxMOV59z
> 1eMAn1qK7FLLN1VHAFSvZ5tjg5GClJ77
> =0kJu
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>


-- 
Alan Wilter SOUSA da SILVA, D.Sc.
Bioinformatician, UniProt - PANDA, EBI-EMBL
CB10 1SD, Hinxton, Cambridge, UK
+44 1223 49 4588
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20110309/8eb8e2d6/attachment.html 


More information about the IPython-User mailing list