FTP Python 550 매개변수 잘못된 파일 이름 오류 (FTP Python 550 Parameter Incorrect Filename Error)


문제 설명

FTP Python 550 매개변수 잘못된 파일 이름 오류 (FTP Python 550 Parameter Incorrect Filename Error)

Python에서 ftplib를 사용하여 이미지를 업로드하고 있습니다. 다음 오류가 표시될 때까지 모든 것이 잘 작동했습니다.

ftplib.error_perm: 550 매개변수가 잘못되었습니다.

코드는 다음과 같습니다.

    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)

생성된 이름을 사용하여 파일을 업로드하려고 하면 오류가 발생합니다. 그러나 test.png만 사용하면 잘 작동합니다.

도움을 주시면 감사하겠습니다. 감사합니다!


참조 솔루션

방법 1:

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"

방법 2:

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

(by AxelSarielLinnyAxelSariel)

참조 문서

  1. FTP Python 550 Parameter Incorrect Filename Error (CC BY‑SA 2.5/3.0/4.0)

#Python #ftplib #FTP






관련 질문

Python - 파일 이름에 특수 문자가 있는 파일의 이름을 바꿀 수 없습니다. (Python - Unable to rename a file with special characters in the file name)

구조화된 배열의 dtype을 변경하면 문자열 데이터가 0이 됩니다. (Changing dtype of structured array zeros out string data)

목록 목록의 효과적인 구현 (Effective implementation of list of lists)

for 루프를 중단하지 않고 if 문을 중지하고 다른 if에 영향을 줍니다. (Stop if statement without breaking for loop and affect other ifs)

기본 숫자를 10 ^ 9 이상으로 늘리면 코드가 작동하지 않습니다. (Code fails to work when i increase the base numbers to anything over 10 ^ 9)

사용자 지정 대화 상자 PyQT5를 닫고 데이터 가져오기 (Close and get data from a custom dialog PyQT5)

Enthought Canopy의 Python: csv 파일 조작 (Python in Enthought Canopy: manipulating csv files)

학생의 이름을 인쇄하려고 하는 것이 잘못된 것은 무엇입니까? (What is wrong with trying to print the name of the student?)

다단계 열 테이블에 부분합 열 추가 (Adding a subtotal column to a multilevel column table)

여러 함수의 변수를 다른 함수로 사용 (Use variables from multiple functions into another function)

리프 텐서의 값을 업데이트하는 적절한 방법은 무엇입니까(예: 경사하강법 업데이트 단계 중) (What's the proper way to update a leaf tensor's values (e.g. during the update step of gradient descent))

Boto3: 조직 단위의 AMI에 시작 권한을 추가하려고 하면 ParamValidationError가 발생합니다. (Boto3: trying to add launch permission to AMI for an organizational unit raises ParamValidationError)







코멘트