diff options
author | Thomas Kluyver <takowl@gmail.com> | 2014-01-23 16:05:11 -0800 |
---|---|---|
committer | Thomas Kluyver <takowl@gmail.com> | 2014-01-23 16:05:11 -0800 |
commit | 71038acb1aa00a7383147f066001e654ca01716c (patch) | |
tree | 0a69c4857b39c371dcc2ea526709b13a38bc5f39 | |
parent | 7a8a720b9703bfe34bc0e94f6b339787438f8862 (diff) | |
download | pexpect-71038acb1aa00a7383147f066001e654ca01716c.tar.gz |
Update pxssh example for Python 3
-rw-r--r-- | pexpect/pxssh.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pexpect/pxssh.py b/pexpect/pxssh.py index f29a4c6..a18076e 100644 --- a/pexpect/pxssh.py +++ b/pexpect/pxssh.py @@ -53,20 +53,20 @@ class pxssh (spawn): hostname = raw_input('hostname: ') username = raw_input('username: ') password = getpass.getpass('password: ') - s.login (hostname, username, password) - s.sendline ('uptime') # run a command + s.login(hostname, username, password) + s.sendline('uptime') # run a command s.prompt() # match the prompt - print s.before # print everything before the prompt. - s.sendline ('ls -l') + print(s.before) # print everything before the prompt. + s.sendline('ls -l') s.prompt() - print s.before - s.sendline ('df') + print(s.before) + s.sendline('df') s.prompt() - print s.before + print(s.before) s.logout() - except pxssh.ExceptionPxssh, e: - print "pxssh failed on login." - print str(e) + except pxssh.ExceptionPxssh as e: + print("pxssh failed on login.") + print(e) Note that if you have ssh-agent running while doing development with pxssh then this can lead to a lot of confusion. Many X display managers (xdm, |