Reputation: 705
[1] The code is:
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 on .py file.
If I leave only the openNotepad() function, then .exe will work.
According to docs: https://github.com/pyinstaller/pyinstaller/wiki/Supported-Packages, the pywinauto library is supported.
If I leave only the Tkinter snippet, the .exe will work.
Therefore please share what I am doing wrong or please suggest other python installer for python 2.7x.
Upvotes: 2
Views: 1455
Reputation: 380
Try to replace every exit()
, quit()
, or os._exit()
with sys.exit()
.
I see that you don't have any of these in your code but somebody else might find this advice to be useful.
My versions: python3.4, pyinstaller3.1.1
Upvotes: 0
Reputation: 705
By commenting out the line starting with: excludedimports in files \PyInstaller\hooks\hook-PIL.py and hook-PIL.SpiderImagePlugin.py, the problem was solved.
Upvotes: 1