diff options
author | Steven Myint <git@stevenmyint.com> | 2013-10-04 08:14:19 -0700 |
---|---|---|
committer | Steven Myint <git@stevenmyint.com> | 2013-10-04 08:14:19 -0700 |
commit | 1cb3226c9d2e57b8ec280433c2ad7c990d63bae0 (patch) | |
tree | 87a6f6019ac0d9ee81b3db2b93ac704be458a75c /examples/ssh_tunnel.py | |
parent | dd0479cb32e55e882a8d1391af2d5b37f25e2db7 (diff) | |
download | pexpect-git-1cb3226c9d2e57b8ec280433c2ad7c990d63bae0.tar.gz |
Modernize
Diffstat (limited to 'examples/ssh_tunnel.py')
-rwxr-xr-x | examples/ssh_tunnel.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/examples/ssh_tunnel.py b/examples/ssh_tunnel.py index 5587f40..03a2e85 100755 --- a/examples/ssh_tunnel.py +++ b/examples/ssh_tunnel.py @@ -32,6 +32,10 @@ PEXPECT LICENSE ''' +from __future__ import print_function + +from __future__ import absolute_import + import pexpect import getpass import time @@ -59,8 +63,8 @@ def start_tunnel (): time.sleep (60) # Cygwin is slow to update process status. ssh_tunnel.expect (pexpect.EOF) - except Exception, e: - print str(e) + except Exception as e: + print(str(e)) def main (): @@ -69,15 +73,15 @@ def main (): time.sleep (1) index = ps.expect (['/usr/bin/ssh', pexpect.EOF, pexpect.TIMEOUT]) if index == 2: - print 'TIMEOUT in ps command...' - print str(ps) + print('TIMEOUT in ps command...') + print(str(ps)) time.sleep (13) if index == 1: - print time.asctime(), - print 'restarting tunnel' + print(time.asctime(), end=' ') + print('restarting tunnel') start_tunnel () time.sleep (11) - print 'tunnel OK' + print('tunnel OK') else: # print 'tunnel OK' time.sleep (7) |