Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Python Programming Language

urllib2.urlopen broken?


In <18023.2281.63362.844@bhuda.mired.org>, Mike Meyer <m@mired.org> 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 <m@mired.org>          http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

In 2.5.1 (and 2.[45], but not 2.3):

--
Mike Meyer <m@mired.org>          http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

En Wed, 06 Jun 2007 16:20:09 -0300, Mike Meyer <m@mired.org> escribi:

> In 2.5.1 (and 2.[45], but not 2.3):

Care to tell some details?

--
Gabriel Genellina

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc