300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 服务器传输文件损坏 使用ftplib将文件传输到FTP服务器后 文件已损坏

服务器传输文件损坏 使用ftplib将文件传输到FTP服务器后 文件已损坏

时间:2023-05-26 19:31:07

相关推荐

服务器传输文件损坏 使用ftplib将文件传输到FTP服务器后 文件已损坏

当我上传.gz文件时,ftplib库出现问题。在

这个脚本以前是有效的,但不知何故,在我数千个版本中的一个版本中,我更改了导致传输损坏文件的某些内容。

文件已成功传输到ftp服务器,但是,在ftp中使用的文件不会打开,因为已损坏。在

要传送的文件没有任何问题。另外,如果文件没有压缩,传输也没有任何问题。它和它的阅读方式有关

有谁能告诉我密码有什么问题吗?在for filename in dir:

os.system("gzip %s/%s" % (Path, filename))

time.sleep(5) # Wait up to 4 seconds to compress file

zip_filename = filename + '.gz'

try:

# Connect to the host

ftp = ftplib.FTP(host)

# Login to the ftp server

ftp.login(username, password)

# Transfer the file

myfile = open(zip_filename, 'rb')

ftp.storlines("STOR temp/" + zip_filename, myfile)

myfile.close()

except ftplib.all_errors as e:

print(e)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。