2

I have created GUI python2.7 program with Tkinter successfully without error. Now I want to make an executable file of it using pyinstaller in anaconda environment (I'm using windows 10).

Using this command pyinstaller --onefile main.py I am able to create exe file successfully in dist folder. But when I tried to run the exe file, it showed error :

Traceback (most recent call last):   
File "main.py", line 333, in <module>   
File "main.py", line 90, in __init__   
File "lib-tk\ttk.py", line 715, in current
_tkinter.TclError: Index 0 out of range 
[22668] Failed to execute script main

Is the problem related to tkinter? I've tried the solution here : Problems with Pyinstaller with tkinter app on python 3.5 and here : How to make pyinstaller import the ttk theme? . But still same error

gameon67
  • 3,601
  • 4
  • 31
  • 54

1 Answers1

1

Try and do:

pyinstaller --onefile -w main.py

The -w flag stops python from bringing up the console, and so this could be why tkinter is failing.

Source: This cool video

I highly recommend you watch this video as it also goes a little in depth on how to clean up after building the exe.

DaJodhi
  • 11
  • 1