import paramiko
host='x.x.x.x'
port=22
username='root'
password='password'
cmd='dmidecode > a'
ssh=paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host,port,username,password)
try:
stdin,stdout,stderr=ssh.exec_command(cmd)
outlines=stdout.readlines()
resp=''.join(outlines)
print(resp)
except paramiko.AuthenticationException as error:
print "ERROR"
I'm unable to catch the AuthenticationException.
Can anyone suggest me any other way to not break the script and only display the error?