擅长:python、mysql、java
<p>读取回溯时,错误深入到ftp堆栈中,处理来自服务器的响应。FTP服务器消息没有标准化,但从文本中可以清楚地看出,FTP服务器无法在远程写入文件。发生这种情况的原因多种多样——可能是权限问题(FTP服务器进程的标识没有对目标的权限)、写入不在服务器上的沙盒设置范围内,甚至写入已在另一个程序中打开</p>
<p>但在您的情况下,当“STOR”命令需要目标路径时,您正在使用完整的源文件名。根据是否要在服务器上写入子目录,计算目标名称可能会变得复杂。如果只需要服务器的当前工作目录,可以</p>
<pre><code>ftp.storbinary(f'STOR {os.path.split(myfile)[1]}', open(myfile, 'rb'))
</code></pre>