Paramiko: Module object has no attribute error 'SSHClient'

Question:

What I found was that if you name your file “paramiko.py” you get this error, but I named my file something else and I still get the same error. I really have no idea what I did wrong, I’m fairly confident I installed PyCrypto and Paramiko successfully.

import paramiko
ssh = paramiko.SSHClient()
ssh.connect('127.0.0.1', username='meelo_rw', password='')

Running this on Windows 8.1.

Asked By: dzzl

||

Answers:

Just to close off the question… if you have a module named paramiko.py that tries to import paramiko, you run the risk that it will try to import itself instead of the real paramiko module. You can rename your module to fix the problem, but be sure to remove the .pyc file also. Python will continue to import the “compiled” .pyc file in preference to the real module.

Answered By: tdelaney

If you have nay file in your local system by the name of "paramiko". The code is going to import that paramiko instead of the python paramiko. You need to rename the file simply and the error will be gone.

Answered By: VANSHIKA SINGOLIA
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.