Skip to content

Commit 5d2d052

Browse files
处理异常报错
1 parent c137abf commit 5d2d052

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

clean.py

+21-5
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,19 @@ def __init__(self, parent=None):
362362
self.run_flash()
363363

364364
def RunSpaceSniffer(self):
365-
exe_path = "WCMain/SpaceSniffer.exe"
366-
process = subprocess.Popen([exe_path])
365+
try:
366+
exe_path = "WCMain/SpaceSniffer.exe"
367+
subprocess.Popen([exe_path])
368+
except Exception as e:
369+
self.RunAPIError_bar()
367370

368-
def RunAppDataCleaner(self):
369-
exe_path = "WCMain/AppDataCleaner.exe"
370-
process = subprocess.Popen([exe_path])
371371

372+
def RunAppDataCleaner(self):
373+
try:
374+
exe_path = "WCMain/AppDataCleaner.exe"
375+
subprocess.Popen([exe_path])
376+
except Exception as e:
377+
self.RunAPIError_bar()
372378
def on_operation_completed(self):
373379
self.info_bar()
374380
print("完成")
@@ -534,6 +540,16 @@ def PermissionError_bar(self):
534540
parent=self,
535541
)
536542

543+
def RunAPIError_bar(self):
544+
InfoBar.warning(
545+
title="出错了!😭",
546+
content="未知错误,请联系开发者",
547+
orient=Qt.Horizontal,
548+
isClosable=True,
549+
position=InfoBarPosition.TOP,
550+
duration=5000,
551+
parent=self,
552+
)
537553

538554
if __name__ == "__main__":
539555
logger.error("请运行 main.py ,而不是 clean.py")

0 commit comments

Comments
 (0)