Problem with infinite recursion in urllib2

Bent Solheim encrypted100 at
Tue Jan 15 18:27:23 CET 2002

I’m trying to open with urllib2, but get
the following error:
Exception exceptions.AttributeError: "'HTTPError' instance has no
attribute 'fp' " in <method HTTPError.__del__ of HTTPError instance at
0x811f7ec> ignored Traceback (most recent call last):
<cut traceback>

Previously, in urllib, infinite recursion caused the Python
interpreter to hang, but in urllib2 this problem is supposed to be
solved. But is this the expected behaviour? In my opinion, this is
wrong. Shouldn’t urllib2 try to resolve the recursion problem
instead of throwing an exception? I.e when encountering a circular
redirect, stop at the url redirecting to the first...

Also in urllib2 on line 613, why use get_host instead of get_full_url.
The way I see it, using get_full_url will result in a more propper
behaviour. I.e. any suburi of the one stored in the passwordmanager
should return a password.

Best regards
curious bent

More information about the Python-list mailing list