From 324947e2f36d7c4cdc8af78d3d4497cfc1f99acb Mon Sep 17 00:00:00 2001 From: Tingfeng Date: Wed, 22 Jun 2022 20:51:29 +0800 Subject: [PATCH] bytesio --- update_plugins.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/update_plugins.py b/update_plugins.py index 176ba7f0..4a1a3e57 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -11,6 +11,7 @@ import shutil import tempfile import urllib.request import zipfile +from io import BytesIO from os import path # --- Globals ---------------------------------------------- @@ -75,7 +76,7 @@ def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): # Download and extract file in temp dir with urllib.request.urlopen(zip_path) as req: with open(temp_zip_path, "wb") as f: - f.write(req.read()) + f.write(BytesIO(req.read())) zip_f = zipfile.ZipFile(temp_zip_path) zip_f.extractall(temp_dir) content_disp = req.headers.get("Content-Disposition")