Eclipse で次のコードを実行すると、getPass は末尾にキャリッジが付加された文字列を返します。
ただし、コマンドプロンプトで同じコードを実行すると、問題なく実行されます。
import paramiko
import getpass
userPwd = getpass.getpass()
print ('You have entered ',userPwd)
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('ese.rnd.sanl.se', username='abc',
password=userPwd)
stdin,stdout,stderr=ssh.exec_command("ls")
data1=stdout.read().splitlines();
for line in data1:
print (line)
出力 (Eclipse):
Warning: Password input may be echoed.
Password: Mypassword@123
('You have entered ', 'Mypassword@123\r')
出力 (コマンド プロンプト):
Warning: Password input may be echoed.
Password: Mypassword@123
('You have entered ', 'Mypassword@123')
誰もこの曖昧さを説明できますか?
ありがとう!!