无法转换为整数。路径“exitCode”。值对于Int32太大或太小。python

2024-05-16 19:52:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我的程序工作正常,但当它完成时会出现如下错误:

无法转换为整数。路径“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()

Tags: pathinfromimportforreturniffind