Skip to content

Commit 2e3d151

Browse files
appstore: fix zipfile import
1 parent e570193 commit 2e3d151

File tree

1 file changed

+5
-7
lines changed
  • internal_filesystem/builtin/apps/com.micropythonos.appstore/assets

1 file changed

+5
-7
lines changed

internal_filesystem/builtin/apps/com.micropythonos.appstore/assets/appstore.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
import time
77
import _thread
88

9+
try:
10+
import zipfile
11+
except ImportError:
12+
print("import zipfile failed, installation won't work!")
13+
914
from mpos.apps import Activity, Intent
1015
import mpos.ui
1116

@@ -166,11 +171,6 @@ def load_icon(icon_path):
166171

167172
class AppDetail(Activity):
168173

169-
try:
170-
import zipfile
171-
except ImportError:
172-
zipfile = None
173-
174174
action_label_install = "Install"
175175
action_label_uninstall = "Uninstall"
176176
action_label_restore = "Restore Built-in"
@@ -374,8 +374,6 @@ def download_and_unzip(self, zip_url, dest_folder, app_fullname):
374374
response.close()
375375
try:
376376
# Step 2: Unzip the file
377-
if zipfile is None:
378-
print("WARNING: zipfile module not available in this MicroPython build, unzip will fail!")
379377
print("Unzipping it to:", dest_folder)
380378
with zipfile.ZipFile(temp_zip_path, "r") as zip_ref:
381379
zip_ref.extractall(dest_folder)

0 commit comments

Comments
 (0)