Re: [IronPython] ironptython xml-rpc how?

2008-02-21 Thread Curt Hagenlocher
On Thu, Feb 21, 2008 at 4:35 AM,  <[EMAIL PROTECTED]> wrote:
>
>  File System, line unknown, in Read
> IOError: Unable to read data from the transport connection: Cannot access
> a disposed object.
> Object name: 'System.Net.Sockets.Socket'..

This is a known issue in IronPython.  You can work around it by using
Seo's implementation of the socket module.  If you're not already
using it, download "IronPython Community Edition" from
http://fepy.sourceforge.net.  Then to replace the built-in socket
module, you'll need to do something like this:

import os, sys, imp
sys.modules['socket'] = module = imp.new_module('socket')
execfile('..\\lib\\socket.py', module.__dict__)
import xmlrpclib
server = xmlrpclib.Server('http://localhost:4567')
month = server.getMonth(2002, 8)

I've tested this and it works.

(Code shamelessly stolen from Birsch's recent BeautifulSoup example.)

--
Curt Hagenlocher
[EMAIL PROTECTED]
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] ironptython xml-rpc how?

2008-02-21 Thread henry
hello there i'me newbie in ironpython. i'm just wondering, is there
any way that ironpython dealing with xml-rpc? cause i had imported
i tried to import xmlrpclib to ironpython with this code

import xmlprclib
server = xmlrpclib.Server("localhost:4567")
month = server.getMonth(2002, 8)

i got this error message :
Traceback (most recent call last):
  File System, line unknown, in Read
  File System, line unknown, in Receive
  File System, line unknown, in Receive
  File , line 0, in ##180
  File xmlrpclib, line unknown, in __call__
  File D:\Python24\Lib\xmlrpclib.py, line 1096, in __call__
  File D:\Python24\Lib\xmlrpclib.py, line 1379, in _ServerProxy__request
  File D:\Python24\Lib\xmlrpclib.py, line 1147, in request
  File D:\Python24\Lib\xmlrpclib.py, line 1276, in _parse_response
  File , line 0, in Read##177
  File System, line unknown, in Read
IOError: Unable to read data from the transport connection: Cannot access
a disp
osed object.
Object name: 'System.Net.Sockets.Socket'..

the code and the server n client are based on xmlrpc in python
based on http://www.ibm.com/developerworks/library/ws-pyth10.html

the server run on python 2.4
here is the code :

import  calendar, SimpleXMLRPCServer

#The server object
class Calendar:
def getMonth(self, year, month):
return calendar.month(year, month)

def getYear(self, year):
return calendar.calendar(year)


calendar_object = Calendar()
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("10.126.11.212", 4567))
server.register_instance(calendar_object)

#Go into the main listener loop
print "Listening on port 4567"
server.serve_forever()



the client run on ironpython 1.1.1 using xmlrpclib on python 2.4.4

import xmlrpclib

server = xmlrpclib.ServerProxy("http://localhost:";)

month = server.getMonth(2002, 8)
print month


can anyone help me with this problem or is there another way to implement
xmlprc client in ironpython ?



___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com