简体   繁体   中英

Trouble Converting .py to ,exe with auto-py-to-exe

I am new to python and tkinter, but I made a Hangman game that uses two external text documents to get words (easy and hard). I want to convert it to.exe but when I try to use auto-py-to-exe, after it finishes converting, the.exe always gives a fatal error. I have tried a variety of settings (one file, one directory, including the text documents as additional files, etc) but the same thing occurs everytime. Any suggestions for settings to use to make it work or other methods to accomplish this?

Thanks!

you could do

file=open("./file.py","r")
content=file.read()
file.close()

file=open("./newfile.txt","w")
file.write(content)
file.close()

I think it will work

Have a nice day X)

What works for me when converting.py to.exe with additional imports (like tkinter) is to add "hidden-imports", it's under the "advanced" tab when you are in auto-py-to-exe.

To get it to work, add "tkinter":

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM