Pyro: ActiveState (wind32) to Unix

Tim Golden mail at timgolden.me.uk
Fri Oct 12 04:32:28 EDT 2007


Sells, Fred wrote:
> I'm using ActiveState python on a windows box to talk to ACtive Directory.  
 > I'm running a Pyro Server on the same box.
> 
> The client is Linux running std Python 2.4.
> 
> It works just fine until the server codes calls some 
 > win32com.client api;  then I get
> 
> 
> Traceback (most recent call last):
>   File "C:\All\projects\AccAdminTools\src\demo002\client\client.py", line 25, in ?
>     unittest()	
>   File "C:\All\projects\AccAdminTools\src\demo002\client\client.py", line 21, in unittest
>     properties = ad.getProperties()
>   File "c:\all\tools\python24\lib\site-packages\Pyro-3.7-py2.4-win32.egg\Pyro\core.py", line 390, in __call__
>     return self.__send(self.__name, args, kwargs)
>   File "c:\all\tools\python24\lib\site-packages\Pyro-3.7-py2.4-win32.egg\Pyro\core.py", line 468, in _invokePYRO
>     return self.adapter.remoteInvocation(name, constants.RIF_VarargsAndKeywords, vargs, kargs)
>   File "c:\all\tools\python24\lib\site-packages\Pyro-3.7-py2.4-win32.egg\Pyro\protocol.py", line 416, in remoteInvocation
>     answer = pickle.loads(answer)
> ImportError: No module named pywintypes
> 
> ____________________the offending code is ________________________________________    def getProperties(self):
>     def getProperties(self):
>       attr_dict={}
>       adobj=win32com.client.GetObject(self.LdapPath)  #<<<<this line causes the error
>       return {'aaa':'bbb'}

It looks to me as though the Pyro server is passing back a "raw"
win32com object, which therefore needs various bits of the pywin32
plumbing in order to work. What happens is that the Pyro server
pickles up the object you return and the client unpickles it. In
order to unpickle, the client must have access to the modules,
classes etc. which the server does. (You can use mobile code etc.
but that wouldn't help here). The problem is, of course, that the
pywin32 stuff is Windows specific.

In short, make sure that whatever you pass back from your Pyro
server is either plain Python types (eg a dict of values etc)
or uses a class which is available -- or at least would work if
passed over by Pyro's mobile code -- on the Linux box.

Is that clear? Or do you need an example?

TJG



More information about the Python-list mailing list