<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>This is a bug. It has never worked&#8212;although it would be
great if it did. As noted in socket.__doc__, socket.makefile() (which
urllib.urlopen() depends on) is not implemented. We&#8217;re aware of the
problem, and I&#8217;ve filed a bug at <a
href="http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&amp;WorkItemId=1368">http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&amp;WorkItemId=1368</a>
to track it.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Here&#8217;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&#8217;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&#8217;t had time yet to implement it.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>--Bruce<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-top:solid #91C0FF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:9.0pt;font-family:"Segoe UI","sans-serif"'>From:</span></b><span
style='font-size:9.0pt;font-family:"Segoe UI","sans-serif"'>
users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com] <b>On
Behalf Of </b>Mike Raath<br>
<b>Sent:</b> Wednesday, July 26, 2006 12:53 AM<br>
<b>To:</b> Discussion of IronPython<br>
<b>Subject:</b> [IronPython] Bug in urllib?<o:p></o:p></span></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'>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. <br>
<br>
&gt;&gt;&gt; import sys<br>
&gt;&gt;&gt; sys.path.append(&quot;C:\\Python24\\Lib&quot;)<br>
&gt;&gt;&gt; import urllib<br>
&gt;&gt;&gt; f = urllib.urlopen(&quot;<a href="http://www.microsoft.com">http://www.microsoft.com
</a>&quot;)<br>
Traceback (most recent call last):<br>
&nbsp; File , line 0, in &lt;stdin&gt;##151<br>
&nbsp; File C:\Python24\Lib\urllib.py, line 82, in urlopen<br>
&nbsp; File C:\Python24\Lib\urllib.py, line 194, in open<br>
&nbsp; File C:\Python24\Lib\urllib.py, line 316, in open_http <br>
&nbsp; File C:\Python24\Lib\httplib.py, line 1150, in getreply<br>
&nbsp; File C:\Python24\Lib\httplib.py, line 863, in getresponse<br>
&nbsp; File C:\Python24\Lib\httplib.py, line 275, in __init__<br>
AttributeError: 'socket' object has no attribute 'makefile' <br>
<br>
Same on CPython 2.4 gives:<br>
&gt;&gt;&gt; import sys<br>
&gt;&gt;&gt; sys.path.append(&quot;C:\\Python24\\Lib&quot;)<br>
&gt;&gt;&gt; import urllib<br>
&gt;&gt;&gt; f = urllib.urlopen(&quot;<a href="http://www.microsoft.com">
http://www.microsoft.com</a>&quot;)<br>
&gt;&gt;&gt; print f.read()<br>
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot; &gt;<br>
<br>
&lt;html dir=&quot;ltr&quot; lang=&quot;en&quot;&gt;<br>
&lt;head&gt; <br>
&lt;META http-equiv=&quot;Content-Type&quot; content=&quot;text/html;
charset=utf-8&quot; &gt;<br>
&lt;!--TOOLBAR_EXEMPT--&gt;<br>
(etc.....)<o:p></o:p></p>

</div>

</body>

</html>