platform issues?


A

Adrian Powell

I'm new to python and I'm trying to get a twitter client running on a new ma=
chine but it keeps on failing. I tracked the problem down to an issue openin=
g URLs and wrote this little test case:

import urllib2
url =3D 'http://www.google.com/'
opener =3D urllib2.build_opener()
url_data =3D opener.open(url).read
url_data


When I run that on a dev machine it works fine, but when it's on one of our =
servers it crashes:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/urllib2.py", line 391, in open
response =3D self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 369, in _call_chain
result =3D func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1173, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1148, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>


Our servers have the same version of python and we're running the same OS (F=
edora 14). Can anyone think of what might be causing this problem, or why it=
works on most (but not all) machines?

Thanks
 
Ad

Advertisements

R

Redcat

Our servers have the same version of python and we're running the same
OS (Fedora 14). Can anyone think of what might be causing this problem,
or why it works on most (but not all) machines?

Thanks

Is the server able to resolve www.google.com properly? If so, are you
POSITIVE that the "url = " line on the server has no typos?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top