Issue 1123695: attempting to use urllib2 on some URLs fails starting on 2.4 (original) (raw)
The following will work correctly on Python 2.3.3 but fails on Python 2.4
Python 2.4 (#1, Dec 4 2004, 01:33:42) [GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import urllib2
urllib2.urlopen('http://www.fanfiction.net/s/636805/10/').read() Traceback (most recent call last): File "", line 1, in ? File "/usr/local/lib/python2.4/socket.py", line 285, in read data = self._sock.recv(recv_size) File "/usr/local/lib/python2.4/httplib.py", line 456, in read return self._read_chunked(amt) File "/usr/local/lib/python2.4/httplib.py", line 495, in _read_chunked chunk_left = int(line, 16) ValueError: invalid literal for int():
Logged In: YES user_id=9205
This bug is in httplib.py, and I already submitted patch 900744. I wonder why on Python 2.3 it seems to work though, it should fail the same way since this bug is also present in Python 2.3. But it might be some change in urllib2 that triggers this in Python 2.4 and not in Python 2.3.