2014-11-04 2 views
0

클라우드에서 boto를 사용하여 로컬 시스템에서 GCS로 파일을 업로드하려고합니다. 파일을 업로드 한 후에 "Content-MD5 또는 x-goog-hash에 지정한 MD5가 계산 한 내용과 일치하지 않습니다."라는 오류가 나타납니다. 아래는 제 코드입니다.파이썬에서 boto를 사용하여 GCS로 파일 업로드하기

def upload(): 
    bucket_name = 'bucketname' 
    bucket = conn.get_bucket(bucket_name) 
    fpic = Key(bucket) 
    d='E:/Eclipse/workspace/Files' 
    for filename in os.listdir(d): 
     contents=d + '/' + filename 
     fpic.key = 'my-files'+filename 
     fpic.set_contents_from_filename(contents, {}, replace = True) 

답변