[英]Shutil unpack archive - Can not unpack temporary zip file - Python
I am trying to download a zip file from the cloud storage in the following manner:我正在尝试通过以下方式从云存储中下载一个 zip 文件:
import shutil
with tempfile.NamedTemporaryFile(suffix=".zip") as source_zip:
aws_util.download(my_buicket, "my_folder/design.zip", source_zip)
shutil.unpack_archive(source_zip.name, "myfile", "zip")
While trying to unpack the temporary zip file created in the step above.在尝试解压缩在上述步骤中创建的临时文件 zip 时。 I am getting the following error:我收到以下错误:
shutil.ReadError: C:\Users\ryan.zhu\AppData\Local\Temp\tmppnn80v56.zip is not a zip file shutil.ReadError: C:\Users\ryan.zhu\AppData\Local\Temp\tmppnn80v56.zip 不是 zip 文件
I am using windows OS.我正在使用 windows 操作系统。
How to solve it.如何解决。 Thanks谢谢
It is possible, that given file does not even exist and given error message is only making you think, that given file is somehow wrong.有可能,给定的文件甚至不存在,给定的错误消息只是让你认为,给定的文件在某种程度上是错误的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.