2017-10-23 5 views
0

누군가가 내 파이썬 코드는 API에 파일을 업로드 실패 이유를 설명 할 수AWS 람다 업로드 파일이/

logger.info("is videofilethere : {} \n".format(os.path.isfile('/tmp/' + videoFileName + '.mp4')))

[정보] 2017-10- 23T05 : 59 : 26.274Z는 52e8b51d-b7b7-11e7-b687-450a720c44f3는 videofilethere 인 트루

하지만

[ERROR 201 7-10-23T05 : 59 : [errno를 2] 26.278Z의 52e8b51d-b7b7-11e7-b687-450a720c44f3

해당 파일하거나 디렉토리

result = subprocess.call("curl -X POST \ 
--header 'Content-Type: multipart/form-data' \ 
--header 'Accept: application/json' \ 
--header Authorization: Bearer sometoken \ 
-F asset='{ \"folderId\": \"12345\", \ 
\"name\": \"blH\", \ 
\"description\": \"Cool new Asset!\", \ 
\"text\": \"Text body.\", \ 
\"EntityType\": \"Asset\"}' \ 
;type=application/json' \ 
-F [email protected]/tmp/somefile.mp4 \ 
-F videoSize=7689755} \ 
\"https://api.blahblah/12345/asset?multipart\" \ 
") 
return result 

답변

1

이 함께 할 수 없다 당신의 /tmp/somefile.mp4.

subprocess.callcurl을 찾을 수 없습니다. callshell=True을 사용해야합니다. 다음은 간단한 예입니다.

+0

셸 추가 = True 고정 감사합니다. – codeexplorer