0

Im trying to delete a remote file from ftps calling curl from python 3.6 and keep getting errors from curl. Im running

proc = subprocess.Popen(["curl", "-v", "-u", ftp_user+":"+ftp_pass, "-k", "--ftp-ssl", "--tlsv1.2", "--ftp-ssl-reqd", "--ftp-pasv", ftpconn, "-Q", '\"DELE '+remote_path+'/'+file+'\"'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
try:
    outs, errs = proc.communicate(timeout=120)
except subprocess.TimeoutExpired:
    proc.kill()

ftpconn is the address of the ftp server

in the response im getting this error:

curl: (21) QUOT command failed with 500

other operations on that ftps using curl, like list, download, upload etc. work fine. i have tried single quotes, double quotes all same result. when running from shell the delete works perfectly. this is the full output of the curl process from stdout:

  • TCP_NODELAY set % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to ******************** port 21 (#0)

} [5 bytes data] * TLSv1.2 (OUT), TLS handshake, Client hello (1): } [167 bytes data] * TLSv1.2 (IN), TLS handshake, Server hello (2): { [85 bytes data] * TLSv1.2 (IN), TLS handshake, Certificate (11): { [4494 bytes data] * TLSv1.2 (IN), TLS handshake, Server key exchange (12): { [333 bytes data] * TLSv1.2 (IN), TLS handshake, Server finished (14): { [4 bytes data] * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): } [70 bytes data] * TLSv1.2 (OUT), TLS change cipher, Client hello (1): } [1 bytes data] * TLSv1.2 (OUT), TLS handshake, Finished (20): } [16 bytes data] * TLSv1.2 (IN), TLS handshake, Finished (20): { [16 bytes data] * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-SHA384 * Server certificate: * start date: Sep 4 00:00:00 2017 GMT * expire date: Aug 25 23:59:59 2019 GMT * issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Organization Validation Secure Server CA * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway. } [5 bytes data]

0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0{ [5 bytes data]

} [5 bytes data]

{ [5 bytes data]

} [5 bytes data]

0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0{ [5 bytes data]

} [5 bytes data]

{ [5 bytes data]

} [5 bytes data]

{ [5 bytes data]

  • Entry path is '/' } [5 bytes data]

  • ftp_perform ends with SECONDARY: 0 { [5 bytes data]

  • QUOT command failed with 500 0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0

  • Closing connection 0 } [5 bytes data]
  • TLSv1.2 (OUT), TLS alert, Client hello (1): } [2 bytes data] curl: (21) QUOT command failed with 500

Process finished with exit code 0

Barak K.
  • 3
  • 2

0 Answers0