"HTTP error -1" from urllib2

John J. Lee jjl at pobox.com
Sat Apr 14 05:59:22 EDT 2007


John Nagle <nagle at animats.com> writes:

>     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:
[...]
> 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".

Can you create an example (preferably small) that fails?  Feel free to
email it to me if it includes something you don't want to post.

Simply fetching the URL you mention with urllib2.urlopen() works for
me, so I guess something extra is needed to reproduce the bug:

import urllib2
r = urllib2.urlopen("http://www.fourmilab.ch")
print r.read()


John



More information about the Python-list mailing list