Tomer,

I took that example from the Rpyc wiki, but you're telling me that it won't 
work.
If it won't work, why is it on the wiki? :-)

The RPYC examples seem to be inconsistent with Rpyc's capabilities.
Can we get some working examples?

>>you might also want to check out plumbum for this use case: 
http://plumbum.readthedocs.org/en/latest/ 
<http://www.google.com/url?q=http%3A%2F%2Fplumbum.readthedocs.org%2Fen%2Flatest%2F&sa=D&sntz=1&usg=AFQjCNG3xZg5_dkkAriTM5jk4wOI9NnInA>
It doesn't seem like plumbum is right for me. I'm not making a cmd line 
util.

I'm just trying to run the python interpreter interactively, but remotely.
It seems like Rpyc should be able to redirect I/O from another machine, but 
I'm not able
to get that working yet.

On Sunday, July 20, 2014 1:05:31 PM UTC-7, Tomer Filiba wrote:
>
> well, you have to put that man-in-the-middle communicate() or something 
> similar: reading the pipes and redirecting the output to their local 
> counterparts. btw, you might also want to check out plumbum for this use 
> case: http://plumbum.readthedocs.org/en/latest/
>
> as for the second version,
>
> proc = conn.modules.subprocess.Popen("ls", stdout = sys.stdout, stderr = 
> sys.stdin)
>
> it won't work because rpyc can't fool the OS. internally, popen dup()s the 
> file handles and does the necessary witchcraft for pipe redirection (which 
> is different under windows, but still involves the OS). the objects you 
> passed are files in the local process, but only proxies to files in the 
> remote side. the actual error you get is meaningless, the problem is it's 
> simply not possible.
>
>
>
> -tomer
>
> -----------------------------------------------------------------
>     
> *Tomer Filiba* 
> tomerfiliba.com     <http://www.facebook.com/tomerfiliba>     
> <http://il.linkedin.com/in/tomerfiliba> 
>
>
> On Fri, Jul 18, 2014 at 12:17 AM, Tony Cappellini <[email protected] 
> <javascript:>> wrote:
>
>>
>> Would someone point me to a better example of redirection stdio-
>> so that I don't need to do this?
>>
>> proc = conn.modules.subprocess.Popen("ls", stdout = -1, stderr = -1)stdout, 
>> stderr = proc.communicate()print stdout.split()
>>
>>
>> http://rpyc.readthedocs.org/en/latest/docs/classic.html#classic
>>
>> If we are running a script on another machine, having to do
>>
>> stdout, stderr = proc.communicate()print stdout.split()
>>
>> is not very helpful.
>>
>> Ideally, what the user experiences on the remote machine, should
>>
>> be seen on the local machine.
>>
>> For some reason,
>>
>> proc = conn.modules.subprocess.Popen("ls", stdout = sys.stdout, stderr = 
>> sys.stdin)
>>
>> causes a terrible exception.
>>
>> I don't understand this
>>
>> >>> 
>> proc=conn.modules.subprocess.Popen("dir",stdout=sys.stdout,stderr=sys.stderr)
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   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
>> AttributeError: 'file' object has no attribute '__eq__'
>>
>> ========= Remote Traceback (2) =========
>> 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\subprocess.py", line 701, in __init__
>>     errread, errwrite), to_close = self._get_handles(stdin, stdout, 
>> stderr)
>>   File "C:\Python27\lib\subprocess.py", line 842, in _get_handles
>>     elif stdout == PIPE:
>>   File "C:\Python27\Lib\site-packages\rpyc\core\netref.py", line 210, in 
>> method
>>     return syncreq(_self, consts.HANDLE_CALLATTR, name, 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
>> AttributeError: 'file' object has no attribute '__eq__'
>>
>> ========= 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 547, 
>> in _handle_callattr
>>     return self._handle_getattr(oid, name)(*args, **dict(kwargs))
>>   File "C:\Python27\Lib\site-packages\rpyc\core\protocol.py", line 541, 
>> in _handle_getattr
>>     return self._access_attr(oid, name, (), "_rpyc_getattr", 
>> "allow_getattr", getattr)
>>   File "C:\Python27\Lib\site-packages\rpyc\core\protocol.py", line 507, 
>> in _access_attr
>>     return accessor(obj, name, *args)
>> AttributeError: 'file' object has no attribute '__eq__'
>>
>>
>>
>>  -- 
>>
>> --- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
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.

Reply via email to