[Biopython] Query

João Rodrigues anaryin at gmail.com
Fri Jul 15 07:44:02 UTC 2011


Hello Isha,

As the error message says, you should not provide the filename to the
function, but instead a file handle. In other words, you need to open the
file first and then provide this to the function.

handle = open("ls_orchid.fasta")
> for seq_record in SeqIO.parse(handle, "fasta"):
>   blablabla


Regards,

João [...] Rodrigues
http://nmr.chem.uu.nl/~joao



On Fri, Jul 15, 2011 at 9:29 AM, isha srivastava <
srivastavaisha.06 at gmail.com> wrote:

>    Hello,
>
>    I am new user of BioPython.
>    I have Downloaded the latest version of BioPython  i.e. BioPython 1.57.
>    fallowed all the instructions according to tutorial.
>    but wen i am running the program :
>
>     >>> from Bio import SeqIO
>     >>> for seq_record in SeqIO.parse("ls_orchid.fasta", "fasta"):
>     ...         print seq_record.id
>     ...         print repr(seq_record.seq)
>     ...         print len(seq_record)
>     ...
>
>
>    it is showing error as fallows :-
>
>    Traceback (most recent call last):
>     File "<stdin>", line 1, in <module>
>     File "/usr/lib/pymodules/python2.6/Bio/SeqIO/__init__.py", line 424, 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)
>
> Sir, how to solve this error?
> Kindly make a soon reply.
>
>
> With due regards,
> Isha
> _______________________________________________
> Biopython mailing list  -  Biopython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
>




More information about the Biopython mailing list