开发者

Pyinstaller, NameError: global name 'quit' is not defined

开发者 https://www.devze.com 2023-04-06 02:46 出处:网络
I have a python script which runs just fine, however after running pyinstall开发者_JAVA技巧er, I get the following when I use a quit() or exit() command:

I have a python script which runs just fine, however after running pyinstall开发者_JAVA技巧er, I get the following when I use a quit() or exit() command:

Makespec file:

# -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(HOMEPATH,'support/useUnicode.py'), 'icinga.py'],
             pathex=['/home/user/projects/icinga_python/releases/onefile_v1.0'])
pyz = PYZ(a.pure)
exe = EXE( pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name=os.path.join('dist', 'icinga'),
          debug=False,
          strip=False,
          upx=True,
          console=1 )

Here is what I see after I run the app:

Traceback (most recent call last):
  File "<string>", line 222, in <module>
  File "<string>", line 207, in main
  File "<string>", line 66, in icinga_mysql
  File "<string>", line 45, in checksanity
NameError: global name 'quit' is not defined


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


quit can be found in pygame.locals import *

Usage:

for event in pygame.event.get():
    if event.type == QUIT:
        pygame.quit()
        sys.exit()


def quit():
    sys.exit()


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

精彩评论

暂无评论...
验证码 换一张
取 消