[IronPython] urllib.urlopen(url).read() problem

Benjamin West bewest at gmail.com
Tue May 22 20:20:03 CEST 2007


I was having trouble using urllib.  I tried using IP 1.1, and IPCE-r6
and got the same results.  I also tried pointing ipy at the stdlib in
both a cygwin install and a windows install with similar results.

Am I doing something wrong?  urllib2 works.
Thanks,
Ben West
---------------------------------------------------------------------------
ipy.exe   -X:ExceptionDetail
IronPython 1.1 (1.1) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import urllib
>>> r = urllib.urlopen('http://www.alexa.com/')
>>> r
>
>>> r.read()
Unable to read data from the transport connection: Cannot access a
disposed object.
Object name: 'System.Net.Sockets.Socket'..
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
offset, Int32 size)
   at IronPython.Runtime.PythonBinaryReader.ReadToEnd() in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonRuntimePythonFile.cs:line
144
   at IronPython.Runtime.PythonFile.Read(Int32 size) in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonRuntimePythonFile.cs:line
1095
   at IronPython.Runtime.PythonFile.Read() in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonRuntimePythonFile.cs:line
1084
   at Read##161(Object )
   at IronPython.Runtime.Calls.CallTarget1.Invoke(Object arg0)
   at IronPython.Runtime.Calls.FastCallableAny.CallInstance(ICallerContext
context, Object arg0) in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonRuntimeCallsFastCallable.Generated.cs:line
186
   at IronPython.Runtime.Calls.BoundBuiltinFunction.Call(ICallerContext
context) in C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonRuntimeCallsBuiltinFunction.Generated.cs:line
73
   at IronPython.Runtime.Operations.Ops.CallWithContext(ICallerContext
context, Object func) in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonRuntimeOperationsOps.Generated.cs:line
78
   at ##160(ModuleScope )
   at IronPython.Hosting.CompiledCodeDelegate.Invoke(ModuleScope moduleScope)
   at IronPython.Hosting.CompiledCode.Run(ModuleScope moduleScope) in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonHostingCompiledCode.cs:line
46
   at IronPython.Hosting.PythonEngine.ExecuteToConsole(String text,
EngineModule engineModule, IDictionary`2 locals) in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonHostingPythonEngine.cs:line
492
   at IronPython.Hosting.PythonEngine.ExecuteToConsole(String text) in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonHostingPythonEngine.cs:line
463
   at IronPythonConsole.PythonCommandLine.DoOneInteractive() in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonConsolePythonCommandLine.cs:line
563
   at IronPythonConsole.PythonCommandLine.b__6(Boolean&
continueInteractionArgument) in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonConsolePythonCommandLine.cs:line
695
   at IronPythonConsole.PythonCommandLine.TryInteractiveAction(InteractiveAction
interactiveAction, Boolean& continueInteraction) in
C:downloadsironpythonIronPython-1.1-SrcIronPython-1.1SrcIronPythonConsolePythonCommandLine.cs:line
605
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags, SocketError& errorCode)
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
offset, Int32 size)
IOError: Unable to read data from the transport connection: Cannot
access a disposed object.
Object name: 'System.Net.Sockets.Socket'..
>>>



More information about the Ironpython-users mailing list