trouble with sys.exec and sockets/ssh

Geoff Gerrietts geoff at gerrietts.net
Sat Feb 22 01:12:46 CET 2003


Quoting Richard Cook (rcook at llnl.gov):
> At 7:52 PM +0000 2/21/03, Donn Cave wrote:
> 
> I knew this question would cause confusion.  Here is my example program:
> 
> import os
> os.execv('ensight7.sos', 'ensight7.sos', '-c', 'somehost.somewhere.gov')


I believe your problem is a consequence of ssh expecting to read and
write to a terminal (tty). I believe if you use the pty module,
pty.spawn() will do what you need. If you need more direct
programmatic control over the spawned creature, I think the pexpect
module (http://pexpect.sourceforge.net) might give you some quality
results.

I could be mistaken, but this is a problem I have had in the past, and
that's how I resolved it, so if it doesn't work for you, I can only
apologize for your wasted time.

Thanks,
--G.

-- 
Geoff Gerrietts                                 <geoff at gerrietts net> 
"A man can't be too careful in the choice of his enemies." --Oscar Wilde





More information about the Python-list mailing list