importerror - Python import paramiko error "cannot import name util" -
i have installed paramiko module. however, when tried import module. got following error.
import paramiko --------------------------------------------------------------------------- importerror traceback (most recent call last) <ipython-input-42-e77d47aa6e4a> in <module>() ----> 1 import paramiko c:\anaconda\lib\site-packages\paramiko\__init__.py in <module>() 28 29 ---> 30 paramiko.transport import securityoptions, transport 31 paramiko.client import sshclient, missinghostkeypolicy, autoaddpolicy, rejectpolicy, warningpolicy 32 paramiko.auth_handler import authhandler c:\anaconda\lib\site-packages\paramiko\transport.py in <module>() 30 31 import paramiko ---> 32 paramiko import util 33 paramiko.auth_handler import authhandler 34 paramiko.ssh_gss import gssauth importerror: cannot import name util does know how resolve issue?
i have had same issue myself (python 2.7.6), , ran answer here importerror: cannot import name x , referred in question's comments, suggesting it's circular dependency issue.
after not finding elegant solution found myself editing paramiko's source code in site-packages/paramiko/transport.py:
- comment / remove line
from paramiko import util - replace every occurrence of
util(in file)paramiko.util - be careful while replacing: not replace existing occurrences of
paramiko.util
this had fixed problem me, leaving me confused: on 1 hand, modifying import method seems solve this, on other hand python deals in like... 99% of cases..? awkward.
Comments
Post a Comment