在另一台计算机上运行程序时出错

时间:2019-04-15 18:37:34

标签: python user-interface pyqt pyqt5

我有一段代码可以在我的计算机上完美运行。我通过电子邮件将此代码发送给朋友,只要他运行它,他此时都会收到TypeError 我已经删除了pySlot()装饰器。我尝试将pySlot()装饰器分类为QtCore.pylot()。它们都不起作用。这些是在Stackoverflow上发布的解决方案。该代码可以在我的计算机上完美运行,但是在朋友计算机上运行时会在下面生成错误消息-我通过电子邮件将.py文件(通过附加到电子邮件中)发给了他

错误消息:

TypeError: connect() failed between clicked(bool) and on_generate_codes()

为什么会这样?

import pandas as pd
import numpy as np
import os 

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QMessageBox

class Ui_Dialog(object):

    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(531, 403)
        Dialog.setFixedSize(531,403)
        self.groupBox = QtWidgets.QGroupBox(Dialog)
        self.groupBox.setGeometry(QtCore.QRect(20, 20, 251, 171))
        self.groupBox.setObjectName("groupBox")



    @pyqtSlot()
    def on_generate_codes(self):

        """ 
        This method belongs to the generate button on the Dialog box
        When a user presses the button, a spreadsheet titled 

        """

    @pyqtSlot()   
    def reconcile(self):

        """
        This method reconciles 
        """

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Mywindow"))
        self.comboBox.setItemText(0, _translate("Dialog", "Mar"))


if __name__ == "__main__"
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Dialog = QtWidgets.QDialog()
    ui = UI_Dialog
    ui.setupUi(Dialog)
    Dialog.show()
    sys.exit(app.exec())

1 个答案:

答案 0 :(得分:0)

当他从电子邮件中复制字符时,可能会有一些难以辨认的字符或多余的空格。 我建议您将其保存在文件中并发送该文件,而不要将代码放入电子邮件中。