![](/img/trans.png)
[英]How to coding to fix Fatal error detected : Failed to execute script BoxDetection after use auto-py-to-exe compile python code to exe file?
[英]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")”,因为我没有使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.