urlerror, urllib2: "no address" ... why or debug tips?

joemynz at gmail.com joemynz at gmail.com
Fri Mar 10 05:05:55 CET 2006


Help please with a URLError. Invoking a url that works in Firefox and
IE results in a "urlerror 7, no address ..." in python. I need to debug
why.

Traceback is below. There's a redirect when the url is invoked (it's
part of a chain) - you can see it using liveheaders in firefox. What is
the best way to debug this? I tried setting debug on HTTPConnection but
this doesn't work (from some web posts, setting debug is broken in
2.4). What's the best way to see what's happening, way to monitor the
call sequences etc?

Any help much appreciated. Thx.

    handle = urllib2.urlopen(req)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 130, in urlopen
    return _opener.open(url, data)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 364, in open
    response = meth(req, response)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 471, in http_response
    response = self.parent.error(
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 396, in error
    result = self._call_chain(*args)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 337, in _call_chain
    result = func(*args)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 554, in http_error_302
    return self.parent.open(new)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 358, in open
    response = self._open(req, data)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 376, in _open
    '_open', req)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 337, in _call_chain
    result = func(*args)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 1021, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 996, in do_open
    raise URLError(err)
URLError: <urlopen error (7, 'No address associated with nodename')>




More information about the Python-list mailing list