<urlopen error (11001, 'getaddrinfo failed')>
opengis at hushmail.com
opengis at hushmail.com
Fri Sep 11 13:29:05 EDT 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
following:
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)
urllib2.install_opener(opener)
...
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
urllib2.urlopen
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:
<servlet>
<servlet-name>cgi</servlet-name>
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-
class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>cgiPathPrefix</param-name>
<param-value>WEB-INF/cgi</param-value>
</init-param>
<init-param>
<param-name>executable</param-name>
<param-value>C:/Program Files/Python25/python.exe</param-value>
</init-param>
<init-param>
<param-name>passShellEnviroment</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cgi</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>
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,
josh
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
>is
>incorrect...
>
>Chris
>
>--
>Simplistix - Content Management, Batch Processing & Python
>Consulting
> - http://www.simplistix.co.uk
More information about the Python-list
mailing list