If you are sure that you use the correct password but still receive the error "AuthenticationException: Authentication failed" , 

Add 2 options allow_agent=False,look_for_keys=False into your connect function
ssh.connect('localhost',username=name,password=pw,allow_agent=False,look_for_keys=False)