【发布时间】:2020-06-25 01:55:28
【问题描述】:
我想使用 Python 将文件上传到租用的 FTP 服务器 (coreserver)。代码是这样的
# -*- coding: utf-8 -*-
import ftplib
def ftp_upload(hostname, username, password, upload_src_path, upload_dst_path):
ftp = ftplib.FTP(hostname)
ftp.set_pasv("true")
ftp.login(username, password)
fp = open(upload_src_path, 'rb')
ftp.storbinary(upload_dst_path ,fp)
ftp.close()
fp.close()
hostname = "example.com"
upload_src_path = "/content/drive/My Drive/DSC_0569.JPG"
upload_dst_path = "STOR /public_html/example.com/"
username = "example"
password = "example"
ftp_upload(hostname, username, password, upload_src_path, upload_dst_path)
但错误是这样发生的
error_perm: 550 /public_html/example.com/: Operation not permitted
我试过了
STOR /public_html/
STOR /public_html
STOR /public_html/example.com/
STOR /public_html/example.com
STOR /example.com/
STOR /example.com
但错误总是发生
error_perm: 550 /public_html/example.com/: Operation not permitted
或
error_perm: 550 /public_html/example.com/: Not a regular file
谁能帮我解决这个问题?
【问题讨论】: