AxelSariel
AxelSariel

Reputation: 384

FTP Python 550 Parameter Incorrect Filename Error

I'm using ftplib on Python to upload an image. Everything was working fine until it started giving me this error:

ftplib.error_perm: 550 The parameter is incorrect.

Here is the code:

    fileNameA = "2020-04-08_00:15.png" # This one gives the error
    fileNameB = "test.png" # This one works well

    cmd = "STOR " + fileName

    f.storbinary(cmd, file)

When it attempts to upload the file using the first name (generated) it gives the error. However, if I just use test.png it works well.

Any help would be appreciated. Thank you!

Upvotes: 0

Views: 1164

Answers (2)

Ben Antonellis
Ben Antonellis

Reputation: 799

Most of the time when using filenames with ftplib, the error is caused because of the :. Change them to underscores, and it should work correctly.

From

fileNameA = "2020-04-08_00:15.png"

to

fileNameA = "2020-04-08_00_15.png"

Upvotes: 2

AxelSariel
AxelSariel

Reputation: 384

In the process of writing my question, I got it working. However, I thought it would be good to post it anyways to help others that may have this same problem, as I struggled to find the correct answer.

The virtual directory path cannot contain the following character: \, ?, ;, :, @, &, =, +, $, ,, |, ", <, >, *.

The name I had used the : to separate the minutes field.

I found this on a Microsoft Support Page: https://support.microsoft.com/en-us/help/2505017/an-error-occurs-when-creating-an-ftp-site-in-internet-information-serv

Upvotes: 0

Related Questions