当我尝试ftp.delete()
从 ftplib 使用时,它会引发error_perm
,resp:
>>> from ftplib import FTP
>>> ftp = FTP("192.168.0.22")
>>> ftp.login("user", "password")
'230 Login successful.'
>>> ftp.cwd("/Public/test/hello/will_i_be_deleted/")
'250 Directory successfully changed.'
>>> ftp.delete("/Public/test/hello/will_i_be_deleted/")
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ftplib.py", line 520, in delete
resp = self.sendcmd('DELE ' + filename)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ftplib.py", line 243, in sendcmd
return self.getresp()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ftplib.py", line 218, in getresp
raise error_perm, resp
ftplib.error_perm: 550 Delete operation failed.
该目录存在,并且“用户”有足够的权限删除该文件夹。
该站点实际上是一个支持 ftp 的 NAS(WD MyBookWorld)。
更改到父目录并使用命令ftp.delete("will_i_be_deleted")
也不起作用。
“will_i_be_deleted”是一个空目录。
WD MyBookWorld 的 ftp 设置:
Service - Enable; Enable Anonymous - No; Port (Default 21) - Default