pty controlling app

Michael Hudson mwh at python.net
Mon Dec 3 12:00:38 CET 2001


bsturk at news.rcn.com (Brian Sturk) writes:

> I am trying to control a shell and found a few posts with
> examples of controlling ssh using the pty module and cribbed the code.
> My issue is I'm unable to get it to execute commands. They just get
> echo'ed back. I found a post where someone had the same issue but never
> posted how he got it to work after he figured it out. :(
> I'm probably missing something very obvious but I've searched
> everywhere and haven't been able to figure it out. Any
> help would be greatly appreciated!

Well, my copy of bash2 prints its version and exits when invoked as

$ bash2 --version

Changing --version to -i and putting in a few more judicious
time.sleep()s, your code seemed to work.  The output is a bit messy
but that's because I have a fancy $PS1.

Cheers,
M.

-- 
59. In English every word can be verbed. Would that it were so in
    our programming languages.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html



More information about the Python-list mailing list