"HTTP error -1" from urllib2
John Nagle
nagle at animats.com
Fri Apr 13 14:16:58 EDT 2007
I'm getting a wierd error from urllib2 when opening certain
URLs. The code works for most sites, but not all of them.
Here's the traceback:
[Thread-2] InfoSitePage EXCEPTION while processing page
"http://www.fourmilab.ch": Problem with page "http://www.fourmilab.ch": HTTP
error -1 - ..
Traceback (most recent call last):
File "D:\projects\sitetruth\InfoSitePage.py", line 318, in httpfetch
fd = url_opener.open(self.requestedurl) # open file by url
File "D:\projects\sitetruth\miscutils.py", line 149, in open
result = urllib.FancyURLopener.open(self, url, *args)
File "D:\python24\lib\urllib.py", line 190, in open
return getattr(self, name)(url)
File "D:\python24\lib\urllib.py", line 322, in open_http
return self.http_error(url, fp, errcode, errmsg, headers)
File "D:\python24\lib\urllib.py", line 339, in http_error
return self.http_error_default(url, fp, errcode, errmsg, headers)
File "D:\projects\sitetruth\miscutils.py", line 144, in http_error_default
raise InfoException.InfoException(self.url, 'HTTP error %s - %s.' %
(errcode, errmsg))
InfoException: Problem with page "http://www.fourmilab.ch": HTTP error -1 - ..
This fails identically using Python 2.4 on a Windows desktop and on Python 2.5
on a Linux server.
The site being accessed reads fine in a browser. It's not a redirect, and it
doesn't insist on cookies.
See "http://mail.python.org/pipermail/python-list/2005-March/314301.html"
for another problem involving "HTTP error -1".
John Nagle
More information about the Python-list
mailing list