<urlopen error (11001, 'getaddrinfo failed')>

opengis at hushmail.com opengis at hushmail.com
Fri Sep 11 19:29:05 CEST 2009

Thank you for the response.  I have been using 
urllib2.urlopen("http://www.openlayers.org"), so I can rule out the 
url being incorrect.  Since my original question I can add the 

1. I am not using a proxy to connect to the internet
2. I added these lines to the script:
     proxy_support = urllib2.ProxyHandler({})
     opener = urllib2.build_opener(proxy_support)
   I believe this tells python not to look for a proxy server.
3. I have added http://www.openlayers.org and its ip to my windows 
hosts file
4. socket.gethostbyname produces the same 11001 error as 

You are spot-on suggesting a dns issue.  It seems like python 
cannot resolve hostnames when it is running in Tomcat 6.  Here is 
my Tomcat cgi config from web.xml:

			<param-value>C:/Program Files/Python25/python.exe</param-value>


The hostnames consistently resolve in Apache Server with the same 
script, so I don't think my dns config is wrong.  I don't have a 
local firewall, but could my network firewall be blocking python 
from takin care of business?  Can anyone share their experience or 
a link on running python in Tomcat?  

thanks again,

On Fri, 11 Sep 2009 08:54:20 -0500 Chris Withers 
<chris at simplistix.co.uk> wrote:
>opengis at hushmail.com wrote:
>> fs = cgi.FieldStorage()
>> url = fs.getvalue('url', "http://www.openlayers.org")
>> try:
>insert a "print url" here...
>>     y = urllib2.urlopen(url)
>>     print y.read()
>> This script produces the "<urlopen error (11001, 'getaddrinfo 
>> failed')>". 
>This is a name lookup failing, whatever you're ending up with in 
>url is 
>either incorrect or the dns config of the server it's pointing at 
>Simplistix - Content Management, Batch Processing & Python 
>            - http://www.simplistix.co.uk

More information about the Python-list mailing list