2

[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.

Vasily Ryabov
  • 9,386
  • 6
  • 25
  • 78
george
  • 685
  • 2
  • 9
  • 22
  • Which version of PyInstaller do you use? – Vasily Ryabov Oct 08 '15 at 10:59
  • 1
    hello guys. I used pyinstaller 3.0 + python 2.7.10, By commenting out the line starting with: excludedimports in files \PyInstaller\hooks\hook-PIL.py and hook-PIL.SpiderImagePlugin.py, the problem was solved. I hope this will help others. – george Oct 08 '15 at 15:07
  • Great! Please answer your own question and mark as accepted to indicate it for others. – Vasily Ryabov Oct 08 '15 at 16:16

2 Answers2

1

By commenting out the line starting with: excludedimports in files \PyInstaller\hooks\hook-PIL.py and hook-PIL.SpiderImagePlugin.py, the problem was solved.

george
  • 685
  • 2
  • 9
  • 22
0

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

pzp
  • 6,249
  • 1
  • 26
  • 38
ALI3N
  • 302
  • 4
  • 10