【发布时间】:2020-11-01 12:28:21
【问题描述】:
在尝试使用 concurrent.futures 模块同时从谷歌驱动器下载文件时,下面的脚本抛出 malloc(): unsorted double linked list corrupted.
files = [
{"id": "2131easd232", "name": "image1.jpg"},
{"id": "2131easdfsd232", "name": "image2.jpg"},
{"id": "2131ea32cesd232", "name": "image3.jpg"}
]
def download_file(data):
request = drive_service.files().get_media(fileId=data['id'])
fh = io.FileIO(data['name'], 'wb')
downloader = MediaIoBaseDownload(fh, request)
done = False
while done is False:
status, done = downloader.next_chunk()
with concurrent.futures.ThreadPoolExecutor() as executor:
executor.map(download_file, files)
malloc(): 未排序的双链表损坏 Aborted (core dumped)
脚本快速执行(在 2 秒内)并且只创建垃圾文件(大小为 0bytes 的文件)。但是我可以同步下载文件而没有任何中断。
【问题讨论】:
标签: python python-3.x google-api google-drive-api concurrent.futures