From 272fb29229d16f9db78ca2a208f38901262885a6 Mon Sep 17 00:00:00 2001 From: GT-Zhang <1029550448@qq.com> Date: Thu, 22 Feb 2024 08:57:04 +0800 Subject: [PATCH] Update base.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix bug 可能存在文件夹不存在的情况 --- qpt/modules/base.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qpt/modules/base.py b/qpt/modules/base.py index 9b2bdd3..d1e25b9 100644 --- a/qpt/modules/base.py +++ b/qpt/modules/base.py @@ -119,9 +119,12 @@ def existing_offline_installation_packages(self): 存在的离线package :return: """ - whl_list = [whl for whl in os.listdir(self.download_packages_path) - if os.path.splitext(whl)[-1] in [".gz", ".whl", "zip"]] - return whl_list + if not os.path.exists(self.download_packages_path): + return list() + else: + whl_list = [whl for whl in os.listdir(self.download_packages_path) + if os.path.splitext(whl)[-1] in [".gz", ".whl", "zip"]] + return whl_list @property def uninstalled_offline_installation_packages(self):