简体   繁体   中英

Invalid base64-encoded string when trying to upload BufferedReader to Azure Blob Storage in Python

Do you guys know what could be the error? when I try to upload the CSVS in a folder to the blob it throws in the first CSV:

Exception: Invalid base64-encoded string: number of data characters (85) cannot be 1 more than a multiple of 4

and I can't find a solution anywhere.

Does anyone know what could be the mistake here? It used to work before.

Thanks!

https://puu.sh/HGd7i/be569f87f7.png

You can check the encoding of the csv data you are trying to upload:

import chardet
with open(csv_file,"rb") as data
chardet.detect(data) 

The output of chardet will be something like:

{'encoding': 'EUC-JP', 'confidence': 0.99}

The libary to detect encoding is: https://github.com/chardet/chardet . Then you can work on converting that encoding and try to upload again

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM