Sorry I don't have a direct answer for your question, but is executing
shell commands on a remote machine all you're trying to to? If so have you
considered libraries that are designed for this, e.g.
Fabric<http://docs.fabfile.org/en/1.4.3/index.html>,
I'm sure there's many more.
A while ago I wrote a fabric script at work that executes expect on a
remote linux machine - I can dig up the code if you need,
Oliver


On 23 August 2012 02:12, shay berman <[email protected]> wrote:
> When I close rpyc pexpect spawn object,  I got the error "AttributeError:
> 'spawn' object has no attribute 'close()' " in the rpyc server stdout.
> BUT pexpect.spawn object has close method.
>
> BTW : Running pecpect locally (without rpyc) there is no problem to run
the
> close method.
>
> Any idea why I get this error?
>
> here is the flow :
> - On the remote_host i starting rpyc server.
>
> - from my leptop I running : rpyc connection + run rpyc spawn on the
> remote_host + close the spawn object.
> Here is the code :
> conn=rpyc.classic.connect('remote_host')
> remote_spawn = conn.modules.pexpect.spawn('/tmp/script.sh')
> remote_spawn.close()
>
> - When the close() executed i got the following error in the stdout of
the
> rpyc server (On the remote_host) :
> DEBUG:SLAVE/18812:Exception caught
> Traceback (most recent call last):
>   File
>
"/var/tmp/xavi-xpyv/lib/python2.7/site-packages/rpyc-3.2.2-py2.7.egg/rpyc/core/protocol.py",
> line 300, in _dispatch_request
>     res = self._HANDLERS[handler](self, *args)
>   File
>
"/var/tmp/xavi-xpyv/lib/python2.7/site-packages/rpyc-3.2.2-py2.7.egg/rpyc/core/protocol.py",
> line 538, in _handle_getattr
>     return self._access_attr(oid, name, (), "_rpyc_getattr",
> "allow_getattr", getattr)
>   File
>
"/var/tmp/xavi-xpyv/lib/python2.7/site-packages/rpyc-3.2.2-py2.7.egg/rpyc/core/protocol.py",
> line 504, in _access_attr
>     return accessor(obj, name, *args)
> AttributeError: 'spawn' object has no attribute 'close()'
> DEBUG:SLAVE/18812:Exception caught
> Traceback (most recent call last):
>   File
>
"/var/tmp/xavi-xpyv/lib/python2.7/site-packages/rpyc-3.2.2-py2.7.egg/rpyc/core/protocol.py",
> line 300, in _dispatch_request
>     res = self._HANDLERS[handler](self, *args)
>   File
>
"/var/tmp/xavi-xpyv/lib/python2.7/site-packages/rpyc-3.2.2-py2.7.egg/rpyc/core/protocol.py",
> line 538, in _handle_getattr
>     return self._access_attr(oid, name, (), "_rpyc_getattr",
> "allow_getattr", getattr)
>   File
>
"/var/tmp/xavi-xpyv/lib/python2.7/site-packages/rpyc-3.2.2-py2.7.egg/rpyc/core/protocol.py",
> line 504, in _access_attr
>     return accessor(obj, name, *args)
> AttributeError: 'spawn' object has no attribute 'close()'
>
> Thanks

Reply via email to