![](/img/trans.png)
[英]python: Invalid base64-encoded string: number of data characters (5) cannot be 1 more than a multiple of 4
[英]Invalid base64-encoded string when trying to upload BufferedReader to Azure Blob Storage in Python
你們知道可能是什么錯誤嗎? 當我嘗試將文件夾中的 CSVS 上傳到 blob 時,它會在第一個 CSV 中拋出:
例外:無效的 base64 編碼字符串:數據字符數 (85) 不能是 1 大於 4 的倍數
而且我在任何地方都找不到解決方案。
有誰知道這里可能是什么錯誤? 以前可以用。
謝謝!
您可以檢查您嘗試上傳的 csv 數據的編碼:
import chardet
with open(csv_file,"rb") as data
chardet.detect(data)
chardet 的 output 將類似於:
{'encoding': 'EUC-JP', 'confidence': 0.99}
檢測編碼的庫是: https://github.com/chardet/chardet 。 然后您可以轉換該編碼並嘗試再次上傳
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.