Skip to content Skip to sidebar Skip to footer

Pyinstaller, Nameerror: Global Name 'quit' Is Not Defined

I have a python script which runs just fine, however after running pyinstaller, I get the following when I use a quit() or exit() command: Makespec file: # -*- mode: python -*- a =

Solution 1:

That is because there is no quit command. You are looking for sys.exit.

Solution 2:

quit can be found in pygame.locals import *

Usage:

foreventin pygame.event.get():
    ifevent.type == QUIT:
        pygame.quit()
        sys.exit()

Solution 3:

defquit():
    sys.exit()


self.quit_button = Button(self, text="QUIT",command = quit)

Post a Comment for "Pyinstaller, Nameerror: Global Name 'quit' Is Not Defined"