Thanks Paul,<div><br></div><div>And how to make my script executable? I mean I tried to put in my test.ipy:</div><div><br></div><div>#!/sw/arch/bin/ipython</div><div><br></div><div>then:</div><div><br></div><div>chmod +x test.ipy</div>
<div><br></div><div>but</div><div><br></div><div>./test.ipy</div><div><br></div><div>won't work.</div><div><br></div><div>Alan<br><br><div class="gmail_quote">On 9 March 2011 09:36, Paul Ivanov <span dir="ltr"><<a href="mailto:pivanov314@gmail.com">pivanov314@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">Alan Wilter Sousa da Silva, on 2011-03-08 11:30, wrote:<br>
> Hi there,<br>
><br>
> I have an script in ipython with things like:<br>
><br>
> head = !grep '^>' ${tax}*.fasta<br>
> gen = [line.split()[1].split(':')[1] for line in head]<br>
><br>
> But if doing in bash terminal:<br>
><br>
> > ipython myscript.py<br>
><br>
> I got this error:<br>
><br>
> File "myscript.py", line 85<br>
> head = !grep '^>' ${tax}*.fasta<br>
> ^<br>
> SyntaxError: invalid syntax<br>
><br>
> WARNING: Failure executing file: <myscript.py><br>
><br>
> How to go around it?<br>
<br>
</div>Hi Alan,<br>
<br>
rename your file to .ipy<br>
<br>
If the file ends with .ipy, you can launch it by<br>
"ipython myscript.ipy" and all the commands are parsed like they<br>
were executed directly in the command line (i.e. they can contain<br>
%magic's and other special ipython directives, which was not the<br>
case previously).<br>
<br>
best,<br>
<font color="#888888">--<br>
Paul Ivanov<br>
314 address only used for lists, off-list direct email at:<br>
<a href="http://pirsquared.org" target="_blank">http://pirsquared.org</a> | GPG/PGP key id: 0x0F3E28F7<br>
</font><br>-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.10 (GNU/Linux)<br>
<br>
iEYEARECAAYFAk13ShAACgkQe+cmRQ8+KPfOXACfen9biGmFban66HjDXxMOV59z<br>
1eMAn1qK7FLLN1VHAFSvZ5tjg5GClJ77<br>
=0kJu<br>
-----END PGP SIGNATURE-----<br>
<br>_______________________________________________<br>
IPython-User mailing list<br>
<a href="mailto:IPython-User@scipy.org">IPython-User@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-user</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Alan Wilter SOUSA da SILVA, D.Sc.<div>Bioinformatician, UniProt - PANDA, EBI-EMBL<br>CB10 1SD, Hinxton, Cambridge, UK</div><div>+44 1223 49 4588</div><br>
</div>