我的程序工作正常,但当它完成时,给出了这样的错误。
无法转换为整数。路径'exitCode'.对于Int32来说,值太大或太小。
Python 3.7
from re import compile
from os import path, walk
from pywinauto import win32api
from easygui import fileopenbox
from pyautogui import confirm, alert
from sys import exit
def Find_Client_Path():
file_name = compile("LeagueClient.exe")
for driver in win32api.GetLogicalDriveStrings().split("\000")[:-1]:
for root, folders, files in walk(driver):
for file in files:
find_file = file_name.search(file)
if find_file:
return path.join(root, file)
return Find_Path_Manually()
def Find_Path_Manually():
alert(
"Please select LeagueClient.exe in Riot Games / League of Legends /.",
title="Warning",
button="Okay",
)
path = fileopenbox()
if path.find("LeagueClient.exe") != -1:
return path
else:
secim = confirm(
"You choose the worng file. Please select LeagueClient.exe in Riot Games / League of Legends / . If you want to close bot click EXIT button.",
title="UYARI!",
buttons=("OKAY", "EXIT"),
)
if secim == "EXIT":
sys.exit()
elif secim == "OKAY":
return Find_Path_Manually()