Skip to content

Commit

Permalink
Fix input
Browse files Browse the repository at this point in the history
  • Loading branch information
scottkmaxwell committed Oct 31, 2013
1 parent 0b7d0cf commit 7cdbbf4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions demos/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ def agent_auth(transport, username):

def manual_auth(username, hostname):
default_auth = 'p'
auth = raw_input('Auth by (p)assword, (r)sa key, or (d)ss key? [%s] ' % default_auth)
auth = input('Auth by (p)assword, (r)sa key, or (d)ss key? [%s] ' % default_auth)
if len(auth) == 0:
auth = default_auth

if auth == 'r':
default_path = os.path.join(os.environ['HOME'], '.ssh', 'id_rsa')
path = raw_input('RSA key [%s]: ' % default_path)
path = input('RSA key [%s]: ' % default_path)
if len(path) == 0:
path = default_path
try:
Expand All @@ -76,7 +76,7 @@ def manual_auth(username, hostname):
t.auth_publickey(username, key)
elif auth == 'd':
default_path = os.path.join(os.environ['HOME'], '.ssh', 'id_dsa')
path = raw_input('DSS key [%s]: ' % default_path)
path = input('DSS key [%s]: ' % default_path)
if len(path) == 0:
path = default_path
try:
Expand All @@ -99,7 +99,7 @@ def manual_auth(username, hostname):
if hostname.find('@') >= 0:
username, hostname = hostname.split('@')
else:
hostname = raw_input('Hostname: ')
hostname = input('Hostname: ')
if len(hostname) == 0:
print('*** Hostname required.')
sys.exit(1)
Expand All @@ -112,8 +112,8 @@ def manual_auth(username, hostname):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((hostname, port))
except Exception, e:
print '*** Connect failed: ' + str(e)
except Exception:
e = sys.exc_info()[1]
print('*** Connect failed: ' + str(e))
traceback.print_exc()
sys.exit(1)
Expand Down Expand Up @@ -150,7 +150,7 @@ def manual_auth(username, hostname):
# get username
if username == '':
default_username = getpass.getuser()
username = raw_input('Username [%s]: ' % default_username)
username = input('Username [%s]: ' % default_username)
if len(username) == 0:
username = default_username

Expand Down

0 comments on commit 7cdbbf4

Please sign in to comment.