1

I have a python program which basically just moves files around between remote FTP server and local machine. I have a bit of code to delete a file on the FTP site, similar to

try:
    ftplib_obj.delete(some_file)
except ftplib.error_perm, e:
    print str(e)
    raise

I'm getting a "550: Delete operation failed", and I have no idea why. The most baffling thing is that I can log in manually, with the same credentials, and delete the file no problem. Any idea what the issue could be, or at least, is there a way I can get a more descriptive error message?

NOTE: I've gone through some possible causes of this error, such as file not existing or permission denied, but none of these apply.

4

1 回答 1

1

你可以做几件事:

  1. 设置调试级别(使用 ftplib_obj.set_debuglevel(9)),这可能会对问题提供一些见解。
  2. 使用函数运行您在交互模式下运行的 FTP 命令

    ftplib_obj.voidcmd('DEL *filename*')  
    
于 2012-09-05T01:07:47.117 回答