获取python脚本中的错误";属性错误:';模块';对象没有属性';认证无'&引用;
我正在编写python脚本,以便使用paramiko登录到ssh服务器。 我写了下面的脚本获取python脚本中的错误";属性错误:';模块';对象没有属性';认证无'&引用;,python,paramiko,Python,Paramiko,我正在编写python脚本,以便使用paramiko登录到ssh服务器。 我写了下面的脚本 #!/usr/bin/python import paramiko ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) paramiko.transport.auth_none('sachin') ssh.connect('localhost', username='sachin', p
#!/usr/bin/python
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
paramiko.transport.auth_none('sachin')
ssh.connect('localhost', username='sachin', password='abc123')
stdin, stdout, stderr = ssh.exec_command('df -h')
print stdout.readlines()
ssh.close()
现在得到下面的错误
AttributeError:“module”对象没有属性“auth\u none”
有人知道我为什么会犯这个错误吗
谢谢 从its(以及错误消息)可以看出,
paramiko.transport
模块不包含名称auth_none
也许你想要
ssh.get_transport().auth_none('sachin')
paramiko.transport
模块不包含名称auth_none
,这可以从its(以及错误消息)中看出
也许你想要
ssh.get_transport().auth_none('sachin')
必须在特定的
Transport
实例上调用auth\u none
,而不是在Transport
模块上调用
由于SSHClient没有等效的,因此您必须使用raw来代替。
auth\u none
必须在特定的传输
实例上调用,而不是在传输
模块上调用
因为SSHClient没有等效的,所以您必须使用raw