I have three Python(3.4.3) scripts. One of them is for controlling the .ui file generated by PyQt5. When I run the GUI program it accepts all the data and everything and whe
I had the same problem in pycharm, python 3.8, qt5. The stacktrace was never shown for qt errors inside pycharm; running the file from cmd the error was shown correctly instead.
I solved by doing the following: open Edit Configurations of the file you want to run, scroll down and check the box Emulate terminal in output console.
You have used self.sender.setText(email)
This is probably causing the problem in my opinion because, "sender" is the name in QObject's function and it does not have any setText attribute, so there may be the problem.
You have to specifically call the widget and setText to it. For this, you can use instances of the py file of the layout creator.
I had the same issue when I was trying to use this self.ui.lineEdit().text()
Here, the problem was -> I was calling the lineEdit function, whereas I had to use it's one attribute.
I have dealt with the same problem, and the answer is twofold:
To catch the exceptions, you need to overwrite the sys exception handler:
# Back up the reference to the exceptionhook
sys._excepthook = sys.excepthook
def my_exception_hook(exctype, value, traceback):
# Print the error and traceback
print(exctype, value, traceback)
# Call the normal Exception hook after
sys._excepthook(exctype, value, traceback)
sys.exit(1)
# Set the exception hook to our wrapping function
sys.excepthook = my_exception_hook
Then in your execution code, wrap it in a try/catch.
try:
sys.exit(app.exec_())
except:
print("Exiting")