gpt4 book ai didi

python - 使用python脚本将文件从windows机器传输到远程solaris机器

转载 作者:太空宇宙 更新时间:2023-11-04 01:42:16 25 4
gpt4 key购买 nike

我使用以下代码在我的本地机器和远程机器之间建立连接:

import os, sys, ftplib

nonpassive=False
remotesite= '10.88.203.21:22'
remoteuser='root'
remotepass='v-peg8!@#'
localdir= "c:\\.."
print "connecting"

connection=ftplib.FTP(remotesite)
print "successfully connected"

connection.login(remoteuser,remotepass)

if nonpassive:
connection.set_pasv(False)

但它给我以下错误:socket.gaierror: [Errno 11001] getaddrinfo 失败..有人可以帮我解决这个问题吗?

最佳答案

您需要将端口指定为单独的参数,而不是您在remotesite 中的方式。尝试:

remotesite = '10.88.203.21'
port = 22
connection = ftplib.FTP(remotesite, port)

参见 FTP docs获取更多信息。

关于python - 使用python脚本将文件从windows机器传输到远程solaris机器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3827986/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com