[BioPython] Huge problems with examples

Iddo Friedberg idoerg at burnham.org
Tue Jul 6 11:58:48 EDT 2004


Thanks for doing this, sorry about your problems. I am running the Linux
version, so I am not sure about your use of examples, Does the Windows
version come with an "examples" directory, or did you just cut & paste
stuff from the Tutorial/Cookbook?

I'll assume there is no such directory, and that you tried to run the
examples from 2.4 in the T/C.


ssalie_lab_staff_health_med_uct at mail.med.uct.ac.za wrote:
> Hi, I've downloaded Biopython onto windows XP and trying examples...quite a 
> few error messages popping up when trying to run 
> 
> C:\>C:\Python23\examples\fasta_iterator.py
> Traceback (most recent call last):
>   File "C:\Python23\examples\fasta_iterator.py", line 29, in ?
>     all_species = extract_organisms("ls_orchid.fasta")
>   File "C:\Python23\examples\fasta_iterator.py", line 7, in extract_organisms
>     file = open(file_to_parse, 'r')
> IOError: [Errno 2] No such file or directory: 'ls_orchid.fasta'
> 
> 

Sounds like it cannot  find the ls_orchid.fasta file. You're supposed to
create it by download from ncbi. See 2.4.2 in the manual.

> 
> C:\>C:\Examples\query_entrez.py
> Traceback (most recent call last):
>   File "C:\Examples\query_entrez.py", line 24, in ?
>     doptcmdl = return_format)
>   File "C:\Python23\Lib\site-packages\Bio\WWW\NCBI.py", line 51, in query
>     return _open(cgi, variables)
>   File "C:\Python23\Lib\site-packages\Bio\WWW\NCBI.py", line 191, in _open
>     handle = urllib.urlopen(fullcgi)
>   File "C:\Python23\lib\urllib.py", line 76, in urlopen
>     return opener.open(url)
>   File "C:\Python23\lib\urllib.py", line 181, in open
>     return getattr(self, name)(url)
>   File "C:\Python23\lib\urllib.py", line 297, in open_http
>     h.endheaders()
>   File "C:\Python23\lib\httplib.py", line 712, in endheaders
>     self._send_output()
>   File "C:\Python23\lib\httplib.py", line 597, in _send_output
>     self.send(msg)
>   File "C:\Python23\lib\httplib.py", line 564, in send
>     self.connect()
>   File "C:\Python23\lib\httplib.py", line 548, in connect
>     raise socket.error, msg
> IOError: [Errno socket error] (10060, 'Operation timed out')
> 

This looks like your connection to NCBI is bad. Either that machine was
not on the net, or you have some sort of connection problem. Generally,
if you can get to NCBI using your browser, you should be able to run
this code. If it is on the net, and you can get to NCBI via your
browser, I would check first for proxy settings, which is usually the
problem in such timeouts.

> 
> C:\>C:\Python23\examples\fasta_consumer.py
> Traceback (most recent call last):
>   File "C:\Python23\examples\fasta_consumer.py", line 35, in ?
>     all_species = extract_organisms("ls_orchid.fasta", 94)
>   File "C:\Python23\examples\fasta_consumer.py", line 21, in extract_organisms
>     scanner = Fasta._Scanner()
> AttributeError: 'module' object has no attribute '_Scanner'


Documentation is outdated. Thanks for the catch. This will be amended soon.

If you want to see how the Bio.Fasta module
works now, "look under the hood" in the source file (Fasta/__init__.py)

The following bit of code (a bit later in the manual) should work:

 >>> from Bio import Fasta
 >>> parser = Fasta.RecordParser()
 >>> file = open("ls_orchid.fasta")
 >>> iterator = Fasta.Iterator(file, parser)

(Provided you have the "ls_orchid.fasta" file, of course :)



> 
> 
> C:\>C:\Python23\examples\getgene.py
> Traceback (most recent call last):
>   File "C:\Python23\examples\getgene.py", line 36, in ?
>     import gdbm
> ImportError: No module named gdbm
> 
> 


This module provides an interface to the GNU DBM (GDBM) library, which
you probably do not have since it is not a standard on Windows. Which 
bit in the T/C did you get this from?




> 
> _______________________________________________
> BioPython mailing list  -  BioPython at biopython.org
> http://biopython.org/mailman/listinfo/biopython
> 
> 

-- 
Iddo Friedberg, Ph.D.
The Burnham Institute
10901 N. Torrey Pines Rd.
La Jolla, CA 92037 USA
Tel: +1 (858) 646 3100 x3516
Fax: +1 (858) 713 9930
http://ffas.ljcrf.edu/~iddo



More information about the BioPython mailing list