以下示例在新的 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
提交
取消