[英]Paramiko : Throwing error when trying to execute python on remote server
I have a program to execute python on a remote server using Paramiko.我有一个程序可以使用 Paramiko 在远程服务器上执行 python。 So it is just that the script to call python is located in one remote server and the script caling is located on another.所以只是调用 python 的脚本位于一台远程服务器上,而脚本调用位于另一台服务器上。
So i thought of using Paramiko.所以我想到了使用 Paramiko。 But it is throwing me error.但这让我犯了错误。 tried to correct error using different methods obtained from stack but in vain.尝试使用从堆栈中获得的不同方法来纠正错误,但徒劳无功。 Can anyone kindy help.任何人都可以帮忙。
import paramiko
import sys
import os
host = "powe76nk.dfrlpw.com"
port = 8015
username = "tre@dfrlpw"
password = "abcd"
command = "D:\***\FlaskTest\Callfunction.py"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, port, username, password)
stdin, stdout, stderr = ssh.exec_command(command)
lines = stdout.readlines()
print(lines)
and it is throwing me error它给我带来了错误
D:\Programs\FlaskAPICallTest\CallingPythonFile>python testingserver.py
Traceback (most recent call last):
File "testingserver.py", line 15, in <module>
ssh.connect(host, port, username, password)
File "C:\Users\fmxdev\AppData\Local\Programs\Python\Python38\lib\site-packages
\paramiko\client.py", line 368, in connect
raise NoValidConnectionsError(errors)
paramiko.ssh_exception.NoValidConnectionsError: [Errno None] Unable to connect t
o port 8015 on *****
was not able to solve this issue and is checking this for the last 2 days.无法解决此问题,并在过去 2 天检查此问题。 Is there any alternate for this有什么替代品吗
Your username should be tre and not tre@dfrlpw.您的用户名应该是 tre 而不是 tre@dfrlpw。
Also can you manually ssh into the server using ssh command or putty?您还可以使用 ssh 命令或腻子手动将 ssh 插入服务器吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.