[BioPython] AttributeError: 'module' object has no attribute 'parse'

Peter biopython at maubp.freeserve.co.uk
Tue Jun 12 17:09:17 UTC 2007


richa wrote:
> Hi all,
> 
> Just installed biopython on ubuntu feisty.  Dependencies and package 
> seemed to install without a problem.  Many of the test files that come 
> with it work fine, but the SeqIO object runs into a problem.   For 
> example, the following code causes an error saying that the 'module' 
> object has no attribute 'parse'.
> 
> Is this a problem of syntax or is it an installation issue?
> 
> from Bio import SeqIO
> handle = open("ls_orchid.fasta", "rU")
> for record in SeqIO.parse(handle, "fasta") :
>    print record.id

That should work. Odd...

What version of Python are you using?

It might be helpful to see the full error message, it should include the 
path to a file .../Bio/SeqIO/__init__.py

If you have a quick look in that file and double check there is a 
function "parse" (e.g. search for "def parse("), and it looks something 
like the latest version, which is online here:

http://cvs.biopython.org/cgi-bin/viewcvs/viewcvs.cgi/biopython/Bio/SeqIO/__init__.py?rev=1.19&cvsroot=biopython&content-type=text/vnd.viewcvs-markup

You said you were using Ubuntu Feisty - did you install Biopython from 
source code by downloading the tar ball, or using "apt-get"?

If you used apt-get then you could try removing the package, and then 
installing from source instead (fairly simple). If that works then maybe 
there is a problem in the Feisty package.


Peter




More information about the Biopython mailing list