Intro:
I have a Linux box with Python 2.7 and RPyC on it. Additionally I have a Windows (Server 2008) box installed with the same Python version, RPyC and pywin32. Windows box runs RPyC classic_server and Linux box is used to run RPyC client. Generally, I'm building infra to manage Active Directory (AD) server in remote from the Linux box. For AD management will be used "pyad" module installed on Windows machine.
Question:
Generally, all this bundle works as promised.
In [3]: conn = rpyc.classic.connect("10.103.224.44")
In [4]: conn.modules.os.getcwd()
Out[4]: 'C:\\ldap-automation-project\\scripts'
But it fails when I try to call remote "pywin32" or "pyad" (pywin32 is a dependency).
In [7]: conn.modules.pywin32
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-31ec7f3bb520> in <module>()
----> 1 conn.modules.pywin32
/usr/lib/python2.7/site-packages/rpyc/core/service.pyc in __getattr__(self, name)
119 return self.__cache[name]
120 def __getattr__(self, name):
--> 121 return self[name]
122
123 class SlaveService(Service):
/usr/lib/python2.7/site-packages/rpyc/core/service.pyc in __getitem__(self, name)
116 name = ".".join(name)
117 if name not in self.__cache:
--> 118 self.__cache[name] = self.__getmodule(name)
119 return self.__cache[name]
120 def __getattr__(self, name):
/usr/lib/python2.7/site-packages/rpyc/core/netref.pyc in __call__(_self, *args, **kwargs)
194 def __call__(_self, *args, **kwargs):
195 kwargs = tuple(kwargs.items())
--> 196 return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
197 __call__.__doc__ = doc
198 return __call__
/usr/lib/python2.7/site-packages/rpyc/core/netref.pyc in syncreq(proxy, handler, *args)
69 raise ReferenceError('weakly-referenced object no longer exists')
70 oid = object.__getattribute__(proxy, "____oid__")
---> 71 return conn.sync_request(handler, oid, *args)
72
73 def asyncreq(proxy, handler, *args):
/usr/lib/python2.7/site-packages/rpyc/core/protocol.pyc in sync_request(self, handler, *args)
439 isexc, obj = self._sync_replies.pop(seq)
440 if isexc:
--> 441 raise obj
442 else:
443 return obj
ImportError: No module named pywin32
========= Remote Traceback (1) =========
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\rpyc\core\protocol.py", line 305, in _dispatch_request
res = self._HANDLERS[handler](self, *args)
File "C:\Python27\lib\site-packages\rpyc\core\protocol.py", line 535, in _handle_call
return self._local_objects[oid](*args, **dict(kwargs))
File "C:\Python27\lib\site-packages\rpyc\core\service.py", line 163, in exposed_getmodule
return __import__(name, None, None, "*")
ImportError: No module named pywin32
Any ideas?