biopython

Thomas Jollans thomas at jollans.com
Mon Jun 14 09:12:36 EDT 2010


On 06/14/2010 02:59 PM, madhuri vio wrote:
> i cudnt run this!!!!!!

Take a deep breath, and read the error message. It's very informative,
and tells you exactly what the problem is, and how to fix it, if you'd
just try to understand it.

It would be much appreciated if you had a look at
http://www.catb.org/~esr/faqs/smart-questions.html
specifically the section "Before you ask", ideally the whole article.

> 
> and this was the error occured
> 
> for seq_record in SeqIO.parse("ls_MTbH37Rv.fasta","fasta"):
> ...     print seq_record.id <http://seq_record.id>
> ...     print repr(seq_record.seq)
> ...     print len(seq_record)
> ...
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line
> 342, in parse
>     raise TypeError("Need a file handle, not a string (i.e. not a
> filename)")
> TypeError: Need a file handle, not a string (i.e. not a filename)

I think this is a fabulous error message. The programmer of this module
actually anticipated the mistake you were going to make. Good for you.

> 
> 
> -- 
> madhuri :)
> 



More information about the Python-list mailing list