Hi,
I am trying to monkey-patch standard "smtplib" module to inject
"socket" module. I am trying this by referring section on
http://rpyc.readthedocs.org/en/latest/docs/howto.html#howto
But unfortunately this is not working for me. the code I used is as below,
import rpyc
import smtplib
conn = rpyc.classic.connect("localhost")
smtplib.socket = conn.modules.socket
server = smtplib.SMTP('localhost')
server.set_debuglevel(1)
server.sendmail("[email protected]", "[email protected]", "Test body")
server.quit()
And I am getting below error
Traceback (most recent call last):
File "test_rpyc.py", line 12, in <module>
server = smtplib.SMTP('localhost')
File "C:\Python27\lib\smtplib.py", line 251, in __init__
(code, msg) = self.connect(host, port)
File "C:\Python27\lib\smtplib.py", line 311, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "C:\Python27\lib\smtplib.py", line 286, in _get_socket
return socket.create_connection((host, port), timeout)
File "C:\Python27\lib\site-packages\rpyc\core\netref.py", line 196, in
__call__
return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
File "C:\Python27\lib\site-packages\rpyc\core\netref.py", line 71, in
syncreq
return conn.sync_request(handler, oid, *args)
File "C:\Python27\lib\site-packages\rpyc\core\protocol.py", line 441, in
sync_request
raise obj
TypeError: a float is required
========= 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\socket.py", line 559, in create_connection
sock.settimeout(timeout)
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
TypeError: a float is required
Can you please help me in achieving this.
Thanks,
Prashant
--
---
You received this message because you are subscribed to the Google Groups
"rpyc" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.