[IronPython] Bug in urllib?

Bruce Christensen t-bruch at microsoft.com
Wed Jul 26 19:04:37 CEST 2006

This is a bug. It has never worked-although it would be great if it did.
As noted in socket.__doc__, socket.makefile() (which urllib.urlopen()
depends on) is not implemented. We're aware of the problem, and I've
filed a bug at
emId=1368 to track it.


Here's the long technical explanation why makefile() is missing: CPython
actually implements the socket module in two parts: _socket.pyd (the
main implementation written in C) and socket.py (a thin wrapper written
in Python). We originally planned to implement only the _socket module
(in C#) and have people use it with the standard socket.py module.
However, we discovered that socket.py depends on CPython's refcounting
garbage collector work correctly, and so we had to modify our socket
module to work without socket.py. Unfortunately, makefile() is one of
the things that socket.py provides, and we haven't had time yet to
implement it.




From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Mike Raath
Sent: Wednesday, July 26, 2006 12:53 AM
To: Discussion of IronPython
Subject: [IronPython] Bug in urllib?


I'm getting an error trying to use urllib - AttributeError: 'socket'
object has no attribute 'makefile' Using 1.0 RC1. Not sure if this has
ever worked - get NotImplementedError: getaddrinfo() is not currently
implemented in the Beta 9. 

>>> import sys
>>> sys.path.append("C:\\Python24\\Lib")
>>> import urllib
>>> f = urllib.urlopen("http://www.microsoft.com ")
Traceback (most recent call last):
  File , line 0, in <stdin>##151
  File C:\Python24\Lib\urllib.py, line 82, in urlopen
  File C:\Python24\Lib\urllib.py, line 194, in open
  File C:\Python24\Lib\urllib.py, line 316, in open_http 
  File C:\Python24\Lib\httplib.py, line 1150, in getreply
  File C:\Python24\Lib\httplib.py, line 863, in getresponse
  File C:\Python24\Lib\httplib.py, line 275, in __init__
AttributeError: 'socket' object has no attribute 'makefile' 

Same on CPython 2.4 gives:
>>> import sys
>>> sys.path.append("C:\\Python24\\Lib")
>>> import urllib
>>> f = urllib.urlopen(" http://www.microsoft.com
<http://www.microsoft.com> ")
>>> print f.read()
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html dir="ltr" lang="en">
<META http-equiv="Content-Type" content="text/html; charset=utf-8" >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060726/57b3736b/attachment.html>

More information about the Ironpython-users mailing list