In <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> typed:
> In 2.5.1 (and 2.[45], but not 2.3):

Sigh. Sorry 'bout that. Since I started it, the breakage is:

Python 2.5.1 (r251:54863, May 15 2007, 15:31:37) 
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> u = urllib2.urlopen('http://www.mired.org/')
>>> u.fileno()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/opt/lib/python2.5/socket.py", line 252, in fileno
    return self._sock.fileno()
AttributeError: HTTPResponse instance has no attribute 'fileno'

The problem is that urlib2 was changed to wrap an HTTPResponse object
in a socket._fileobject to get a few more file methods. Except (as
reported above) HTTPResponse doesn't have a fileno() method, so when
_fileobject tries to use it, it blows up.

Adding an appropriate method to HTTPResponse:

  def fileno(self):
      return self.fp.fileno()

fixes the problem, but may not be the best solution. If no one
suggests a better one, I'll file the appropriate bug report.

        <mike
-- 
Mike Meyer <[EMAIL PROTECTED]>          http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to