In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Python 3 call paramiko module error AttributeError: module how to do, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
Python 3 calls paramiko module to report error AttributeError: module 'paramiko' has no attribute' SSHClient'
[root@MySQL01 script] # python paramiko.py
Exception occurs...
Traceback (most recent call last):
File "paramiko.py", line 2, in
Import paramiko
File "/ script/paramiko.py", line 8, in
Client = paramiko.SSHClient ()
AttributeError: module 'paramiko' has no attribute' SSHClient'
# script content
#! / usr/bin/env python
Import paramiko
Username = "root"
Password = "123456"
Hostname = "192.168.56.102"
Port = 22
Try:
Client = paramiko.SSHClient ()
Client.set_missing_host_key_policy (paramiko.AutoAddPolicy ())
Client.connect (hostname, port, username, password)
T = client.get_transport ()
Sftp=paramiko.SFTPClient.from_transport (t)
D = sftp.stat ("/ opt/archer-1.1.1.zip")
Print (d)
Stdin, stdout, stderr = client.exec_command ('ls-trlh')
Result = stdout.readlines ()
Print (result)
Except Exception:
Print ('Exception occurs...')
Raise
Reason for reporting an error:
The python file name is the same as the paramiko module name.
Solution:
Rename the script name.
[root@MySQL01 script] # mv paramiko.py para.py
# call normally
[root@MySQL01 script] # python para.py
-rw-r--r-- 100 1431181 30 Mar 11:40?
['total 104K\ nfolk,'-rw-r--r--. 1 root root 9.8K Dec 13 14:26 install.log.syslog\ n rw-r--r--.,'- rw-r--r--. 1 root root 50K Dec 13 14:29 install.log\ n rw-.,'- rw-. 1 root root 1.6K Dec 13 14:29 anaconda-ks.cfg, 'drwxr-xr-x. 2 root root 4.0K Dec 13 14:37 Templates, 'drwxr-xr-x. 2 root root 4.0K Dec 13 14:37 Public, 'drwxr-xr-x. 2 root root 4.0K Dec 13 14:37 Downloads, 'drwxr-xr-x. 2 root root 4.0K Dec 13 14:37 Documents, 'drwxr-xr-x. 2 root root 4.0K Dec 13 14:37 Desktop, 'drwxr-xr-x. 2 root root 4.0K Dec 13 14:37 Videos, 'drwxr-xr-x. 2 root root 4.0K Dec 13 14:37 Pictures, 'drwxr-xr-x. 2 root root 4.0K Dec 13 14:37 Music\ n rw-r--r--.,'- rw-r--r--. 1 root root 0 Feb 14 23:19 20180405.txt\ n']
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.