Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16508

Re: platform issues?

Date 2011-12-01 19:41 +0100
From Jean-Michel Pichavant <jeanmichel@sequans.com>
Subject Re: platform issues?
References <20111201124122.8818@web003.roc2.bluetie.com>
Newsgroups comp.lang.python
Message-ID <mailman.3205.1322764928.27778.python-list@python.org> (permalink)

Show all headers | View raw


Adrian Powell wrote:
> I'm new to python and I'm trying to get a twitter client running on a new machine but it keeps on failing. I tracked the problem down to an issue opening URLs and wrote this little test case:
>
> import urllib2
> url = 'http://www.google.com/'
> opener = urllib2.build_opener()
> url_data = 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:
>
>   
>>>> import urllib2
>>>> url = 'http://www.google.com/'
>>>> opener = urllib2.build_opener()
>>>> url_data = opener.open(url).read
>>>>         
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python2.7/urllib2.py", line 391, in open
>     response = 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 = 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 (Fedora 14). Can anyone think of what might be causing this problem, or why it works on most (but not all) machines?
>
> Thanks
>   
Actually, Python did not crashed, some module raised an exception and 
nothing has been written to handle that exception, hence python 
stopping. But as you can see, python gave you a lot of meaningful 
informations about why it was not able to continue execution.

urllib2.URLError: <urlopen error [Errno -2] Name or service not known>


Your server may not be able to resolve that URL while your local dev 
machine can.

JM

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: platform issues? Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-01 19:41 +0100

csiph-web