以下示例在新的 ipython 控制台 (spyder) 中运行时返回“-1”,但仅在第一次尝试时返回。之后它似乎工作正常。from PyQt5 import QtWidgets, QtGui, QtCorefrom GUI import Ui_MainWindow # importing our generated fileimport sysimport numpy as npclass mywindow(QtWidgets.QMainWindow): def __init__(self): super(mywindow, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self)app = QtCore.QCoreApplication.instance()if app is None: app = QtWidgets.QApplication(sys.argv)application = mywindow()application.show()sys.exit(app.exec())错误如下:>runfile('C:/Users/xxx.py', wdir='C:/Users/xx/Documents/3dPackaging') 发生异常,使用 %tb 查看完整的回溯。系统退出:-1C:\Users\xx\Documents\Anaconda\lib\site-packages\IPython\core\interactiveshell.py:2969: UserWarning: 要退出:使用“退出”、“退出”或 Ctrl-D。警告(“退出:使用'退出','退出'或Ctrl-D。”,stacklevel=1)%tb 回溯(最近一次调用):File "", line 1, in runfile('C:/Users/xxx.py', wdir='C:/Users/xx')文件“C:\Users\xx\Documents\Anaconda\lib\site-packages\spyder_kernels\customize\spydercustomize.py”,第 668 行,在运行文件 execfile(filename, namespace) 中文件“C:\Users\xx\Documents\Anaconda\lib\site-packages\spyder_kernels\customize\spydercustomize.py”,第 108 行,在 execfile exec(compile(f.read(), filename, 'exec'),命名空间)文件“C:/Users/xx/Documents/3dPackaging/VersandkartonsPacken.py”,第 64 行,在 sys.exit(app.exec())系统退出:-1我不知道这可能是什么,但因为有一天这应该是一个独立的程序,我担心它可能会很混乱,所以我宁愿修复它。我应该尝试什么?
添加回答
举报
0/150
提交
取消