Fatal Error: Failed to execute "script name" | auto-py-to-exe

Fatal Error: Failed to execute "script name" | auto-py-to-exe

这是代码。我正在用 auto-py-to-exe.

将它编译成一个 exe
from tkinter import *
import os

master = Tk()
master.title('Power Options')
master.geometry("300x100")
master.wm_iconbitmap("poweroptions.ico")

def fun():
    os.system('cmd /k shutdown /s /f /t 0')

def fun2():
    os.system('cmd /k shutdown /r /f /t 0')

def fun3():
    os.system("rundll32.exe powrprof.dll,SetSuspendState 0,1,0")

b1 = Button(master,text = "  Shutdown  ",command = fun,activeforeground = "red",activebackground = "pink",padx=10)
b2 = Button(master,text = "   Restart   ",command = fun2,activeforeground = "red",activebackground = "pink",padx=10)
b3 = Button(master,text = "    Sleep    ",command = fun3,activeforeground = "red",activebackground = "pink",padx=10)

b3.place(relx=0.5, rely=0.5, anchor=CENTER)
b1.place(relx=0.1, rely=0.5, anchor=W)
b2.place(relx=0.9, rely=0.5, anchor=E)

master.mainloop()

当我编译它时,它在我 运行 时给我标题中的错误。当我 运行 作为 python (.py) 文件时,脚本 运行 没问题。

解决了。只需要删除 "master.wm_iconbitmap("poweroptions.ico")" 因为我没有使用它。