Python & # 8594; pyinstaller -.exe file will return "test received -1"

[1] Code:

import Tkinter
from Tkinter import *

# Create Tk instance
root = Tkinter.Tk(className="test")


# Open Notepad
def openNotepad():
    import pywinauto
    app = pywinauto.Application.start("notepad.exe")


# Add menu 
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label="01 File", menu=filemenu)
filemenu.add_command(label="New", command=openNotepad)

# Pack all
root.mainloop()

[2] The code works if I double-click the .py file.

If I left only the openNotepad () function, then .exe will work.

According to docs: https://github.com/pyinstaller/pyinstaller/wiki/Supported-Packages , pywinauto library is supported.

If I leave only the Tkinter fragment, .exe will work.

So please share what I'm doing wrong, or suggest another python installer for python 2.7x.

+2
source share
2 answers

, : excludedimports \PyInstaller\hooks\hook-PIL.py hook-PIL.SpiderImagePlugin.py, .

+1

exit(), quit() os._exit() sys.exit(). , , - .

: python3.4, pyinstaller3.1.1

0

Source: https://habr.com/ru/post/1615439/


All Articles