title: Python PyInstaller - Failed to execute script Error
body: <p>I have a code, which i want to pack as an EXE. The package packs completely, but whenever i run it, it says</p>
  <blockquote>
  <p>Failed to execute script</p>
  </blockquote>
  <p>My code:</p>
  <pre><code>from tkinter import *
  import tkinter.messagebox as tmsg
  import string
  import random
  
  root = Tk()
  
  def helpf():
      tmsg.showinfo(&quot;How it works&quot;, &quot;Enter the length of the password required\nThen select the strength of password\nClick the generate button to receive the password.\nClick on File-&gt;Save to Save the genrated Password&quot;)
  
  def savefile():
      f=open('/Passwords.txt', 'a')
      f.write(pwd +'\n')
      f.close()
  
  def password():
      global pwd 
      pwd=&quot;&quot;   
      #pwd=str()
      #pwd=&quot;&quot;
      value = str()
      if (Lengthvalue.get()&gt;16) or (Lengthvalue.get()==&quot;&quot;):
         Label(text=&quot;Please enter a correct password strength&quot;).grid(row=6,column=1) 
         
      if Weakvalue.get()==1:
          value = string.ascii_letters
      elif Moderatevalue.get()==1:
          value = string.ascii_letters + string.digits
      elif Strongvalue.get()==1:
          value = string.ascii_letters + string.digits + '!?@#'
      else:
         Label(text=&quot;Please select Password Strength&quot;).grid(row=6,column=1) 
      
      if value!=str():
          Label(text=&quot;                                                                 &quot;).grid(row=6,column=1)
          for x in range(0,Lengthvalue.get()):
              pwd = pwd + random.choice(value)
          Label(text=pwd,font=(&quot;Goodtimes&quot;,10, &quot;bold&quot;)).grid(row=6, column=1)
      
  #def password():
      #print(Weakvalue, Moderatevalue, Strongvalue)
      
  root.geometry(&quot;500x400&quot;)
  root.minsize(500,400)
  root.maxsize(500,400)
  root.title(&quot;Random Password Generator&quot;)
  
  #Heading
  Label(text=&quot;Random Password Generator&quot;, bg=&quot;red&quot;, font=(&quot;Forte&quot;,15, &quot;bold&quot;),borderwidth=5, relief=RIDGE).grid(row=0, column=1)
  
  #CheckBox
  Lengthvalue=IntVar()
  Weakvalue=IntVar()
  Moderatevalue=IntVar()
  Strongvalue=IntVar()
  
  Label(text=&quot;Enter the length of\nPassword Required:\n(Between 8-16) &quot;).grid(row=1, column=0)
  Label(text=&quot;Select the Strength of\nPassword Required: &quot;).grid(row=3, column=0)
  
  Length=Entry(root, textvariable=Lengthvalue)
  Weak=Checkbutton(text=&quot;Weak Password&quot;, variable=Weakvalue)
  Moderate=Checkbutton(text=&quot;Moderate Password&quot;, variable=Moderatevalue)
  Strong=Checkbutton(text=&quot;Strong Password&quot;, variable=Strongvalue)
  
  Length.grid(row=1, column=1)
  Weak.grid(row=3, column=1)
  Moderate.grid(row=4, column=1)
  Strong.grid(row=5, column=1)
  
  #Generate Password Button
  fr=Frame(root, borderwidth=3, bg=&quot;grey&quot;, relief=SUNKEN)
  fr.grid(row=8, column=1)
  b1=Button(fr, bg=&quot;white&quot;, text=&quot;Generate&quot;, command=password)
  b1.grid(row=8, column=1)
  
  #Adding Menus
  mainmenu=Menu(root)
  
  filemenu=Menu(mainmenu, tearoff=0)
  filemenu.add_command(label=&quot;Save&quot;, command=savefile)
  filemenu.add_separator()
  filemenu.add_command(label=&quot;Exit&quot;, command=quit)
  mainmenu.add_cascade(label=&quot;File&quot;, menu=filemenu)
  root.config(menu=mainmenu)
  
  helpmenu=Menu(mainmenu, tearoff=0)
  helpmenu.add_command(label=&quot;How it works&quot;, command=helpf)
  mainmenu.add_cascade(label=&quot;Help&quot;, menu=helpmenu)
  root.config(menu=mainmenu)
  
  root.mainloop()
  </code></pre>
  <p>It is a random password generator, and it creates and saves its answer in .txt file in the same directory.</p>
  <p>Python version 3.60 (Downgraded it for pyinstaller to work)</p>