title: Why does a PyInstaller executable terminate when the built-in quit function is mentioned (not called)?
body: <p>In the below code, the list of dictionaries named <code>options</code> contains mention of the <code>quit</code> built-in function. The function is not called until it passes a check against user input. Its name is just stored in that list for when it's needed later.</p>
  <pre><code>def my_function():
      input(&quot;my_function successfully executed, input anything to end program&gt; &quot;)
  
  def choose_from_menu():
  
      options =   [
                  {&quot;description&quot;:&quot;. Execute my_function.&quot;,
              &quot;method&quot;:my_function},
                  {&quot;description&quot;:&quot;. Terminate program.&quot;,
              &quot;method&quot;:quit}
                  ]
  
      for i in options:
          print(str(options.index(i) + 1) + i[&quot;description&quot;])
  
      chosen = input(&quot;Choose an option. &gt; &quot;)
  
      for i in options:
          if chosen == str(options.index(i) + 1):
              # here it gets called
              i[&quot;method&quot;]()
  
  choose_from_menu()
  </code></pre>
  <p>Run with the Python interpreter, the script lets the user choose from the printed list, and the correlating method gets picked from <code>options</code> and then called.</p>
  <p>But when this script is turned into an executable with PyInstaller (on my machine, on Windows) and run, it seems to terminate the moment it sees mention of the quit function inside the options list, therefore never reaching the input prompt in the first place. (Notably, it did this with quit, but not with my_function.)</p>
  <p>Why?</p>
  <p>I tried defining my own method that contains a quit call, and storing that name in the dictionary instead. It does bypass this situation. However, doing that doesn't enlighten me as to the reason for this contrast between interpreter and compiler.</p>
  <p>When the executable is run with PowerShell's Start-Process commandlet, no error is displayed.</p>