1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > PyQt5报错Process finished with exit code -1073740791 (0xC0000409)

PyQt5报错Process finished with exit code -1073740791 (0xC0000409)

时间:2022-04-06 15:23:33

相关推荐

PyQt5报错Process finished with exit code -1073740791 (0xC0000409)

使用pyqt设计了一个界面,然后写了一个读取文件的函数,其中读取文件部分代码:

curPath = QDir.currentPath() # 获取系统当前目录title = "打开一个文件"filt = "文本文件(*.txt *.csv *.xlsx);;程序文件(*.h *.cpp *.py);;所有文件(*.*)"fileName, flt = QFileDialog.getOpenFileName(self, title, curPath, filt)

链接到一个按钮,运行后在该界面点击按钮报错:

Process finished with exit code -1073740791 (0xC0000409)

以下的方法仅供参考,谨在此记录。

解决办法:

这个错误其实原因很多的,所以在pycharm打开,run > edit configuration > emulate terminal in output console勾上,再运行一次,立马提示出了什么错误。。。

我的错误:

TypeError: getOpenFileName(parent: QWidget = None, caption: str = ‘’, directory: str = ‘’, filter: str = ‘’, initialFilter: str = ‘’, options: Union[QFileDialog.Options, QFileDialog.Op

tion] = 0): argument 1 has unexpected type ‘Ui_MainWindow’

然后按照网上的方法把fileName, flt = QFileDialog.getOpenFileName(self, title, curPath, filt)中的self修改为None,该错误就解决了

还有另外一种情况会导致PyQt5报错Process finished with exit code -1073740791 (0xC0000409)(以下错误来源于然终酒肆,在此记录,以防将来遇到不好查找)

这次查它报错 果不其然

这个控件名要有下划线的

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。