Question: Biopython - E-Utilities Problem
0
gravatar for Olivier
7.4 years ago by
Olivier440
Olivier440 wrote:

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.3k views
ADD COMMENTlink modified 5.5 years ago by Biostar ♦♦ 20 • written 7.4 years ago by Olivier440
2
gravatar for Olivier
7.4 years ago by
Olivier440
Olivier440 wrote:

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 COMMENTlink modified 7.4 years ago • written 7.4 years ago by Olivier440
1
gravatar for Istvan Albert
7.4 years ago by
Istvan Albert ♦♦ 81k
University Park, USA
Istvan Albert ♦♦ 81k wrote:

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 COMMENTlink written 7.4 years ago by Istvan Albert ♦♦ 81k

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 REPLYlink modified 7.4 years ago • written 7.4 years ago by Olivier440
1

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 REPLYlink written 7.4 years ago by Peter5.8k
1

as Peter says try:

import urllib
urllib.urlopen('http://www.ncbi.nlm.nih.gov/')
ADD REPLYlink written 7.4 years ago by Istvan Albert ♦♦ 81k

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 REPLYlink modified 7.4 years ago by Istvan Albert ♦♦ 81k • written 7.4 years ago by Olivier440

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 REPLYlink written 7.4 years ago by Olivier440

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 REPLYlink written 7.4 years ago by Istvan Albert ♦♦ 81k

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

ADD REPLYlink written 7.4 years ago by Olivier440

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 REPLYlink modified 7.4 years ago • written 7.4 years ago by Olivier440
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2024 users visited in the last hour