Biopython - E-Utilities Problem
2
0
Entering edit mode
8.9 years ago
Olivier ▴ 440

Hello I have installed python 2.73 and Biopython 1.57 on Ubuntu 11.10. All of the Bio modules I have tried are working fine, except for the Entrez. None of the e-utils are working - the online tests failed after the installation of biopython. Do I have to register to use the E-utils? Even when I try try "urllib.urlopen('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi')", idle-python hangs..(But the url works on Firefox.) Changing socket defaulttimeout doesn't help either. Here's what I get when I try einfo()

>>> from Bio import Entrez
>>> Entrez.email = 'my_email_address'
>>> handle = Entrez.einfo()
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    handle = Entrez.einfo()
  File "/usr/lib/pymodules/python2.7/Bio/Entrez/__init__.py", line 186, in einfo
    return _open(cgi, variables)
  File "/usr/lib/pymodules/python2.7/Bio/Entrez/__init__.py", line 358, in _open
    handle = urllib2.urlopen(cgi)
  File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 394, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 412, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1201, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1171, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 110] Connection timed out>

Grateful if you could help.

biopython • 5.8k views
ADD COMMENT
2
Entering edit mode
8.9 years ago
Olivier ▴ 440

The code below was included at the top of the scripts that I tried.

import os os.environ['http_proxy'] = '130.14.29.110:80'

ADD COMMENT
1
Entering edit mode
8.9 years ago

As the error says it is unable to connect to the internet.

It is either that the website does not allow your IP for some reason or perhaps there is a firewall blocking the outgoing connection.

ADD COMMENT
0
Entering edit mode

Thanks for the help. I've tried disabling my firewall, but the problem is still unchanged. I wonder why the link works in firefox but not through biopython. I've read it could be a proxy problem. I have the proxy address of my ISP but I not sure how to set it up. I'm not very familiar with these. I tried to set up the default http port with the ISP's ip 'xxx.xxx.xxx.xxx:80' but it does not work. (When I ping the proxy it doesn't reply back.) Here's how I tried it on python:

import os os.environ["http_proxy"] = ["http://xxx.xxx.xxx.xxx:80"]

Grateful if you could help. I'm stuck at this part of the biopython tutorial.

ADD REPLY
1
Entering edit mode

Have you checked if you can use Python's urllib to connect to ANY website? That will tell you if this is an NCBI specific problem, or more general.

ADD REPLY
1
Entering edit mode

as Peter says try:

import urllib
urllib.urlopen('http://www.ncbi.nlm.nih.gov/')
ADD REPLY
0
Entering edit mode

It hangs for ncbi, but when i tried an article on wikipedia, it works. 'yahoo.com' also works

>>> urllib.urlopen('http://en.wikipedia.org/wiki/K-mer')
<addinfourl at="" 161140204="" whose="" fp="&lt;socket._fileobject" object="" at="" 0x99b42ec="">>
>>> wiki = urllib.urlopen('http://en.wikipedia.org/wiki/K-mer')
>>> wiki.read()
'\n<html xmlns="&lt;a href=" http:="" www.w3.org="" 1999="" xhtml"="" rel="nofollow">http://www.w3.org/1999/xhtml" xml:lang="en"

...etc

What can I do?

ADD REPLY
0
Entering edit mode

Hello Can somebody help? I'm still stuck, not being able to access anything on NCBI using Biopython. Tried to contact NCBI helpdesk to know if I'm blocked, but I have got no reply.

ADD REPLY
0
Entering edit mode

this is a problem on your system - for some reason you are not allowed to connect. Move to a different computer on a different network.

ADD REPLY
0
Entering edit mode

Thanks. I'll try a different network tomorrow. Could it it be because I'm behind a router that it's not working?

ADD REPLY
0
Entering edit mode

Finally found the answer :-) I only had to add the e-utils IP as proxy. And it works. I hope it's the right procedure.

os.environ['http_proxy'] = '130.14.29.110:80'

Thanks a lot for your help Istvan and Peter.

ADD REPLY

Login before adding your answer.

Traffic: 1184 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6