I am writing an application using pyQT. I do not know if version 5.5 toli has such a problem or is it typical for it. But then the application with the value 1 falls and the fool will sort it out what the error was. One thing I know, it is precisely connected with pyQT (it localized the place where it was stopped, and more than once). Sooner or later I find the cause of the error, but in the blind pumpkin hesitated.

Is there a way to get information about such an error?

  • I understand that there are no source codes either? - KoVadim
  • What's the point? The point is not a specific error. I noticed it more than once and in different situations. - Riĥard Brugekĥaim
  • I can think of a dozen situations, as the program "can fall with a value of 1". And in each case there will be a different description of the reasons. Or maybe it will not even fall. - KoVadim
  • So the crux of the matter is not in error !!! Is it possible to display them then ?! In the output stream to send. - Riĥard Brugekĥaim
  • one
    If you run the application yourself and it returns code 1 (and this is a private matter of the application, why did it return such a code), that is, the variable $? which stores it. read on - KoVadim

1 answer 1

It is very strange that you crash in QT. So in most cases, either Exception occurs, from which it is easy to understand what the problem is. Or QT falls in Segmentation fault.

Then, as KoVadim wrote to you, the returned code is the developer's business. He could decide in some situations to return a non-zero code.

Also, a nonzero code may be returned due to the development environment, for example, PyCharm had an error and when the debug code returned 135. And then you need to look at the documentation and / or IDE bugtracker.

The returned code from QT is determined by two methods, if quit is called in the application (by default), it will be 0, or exit (return code) is called, then the return code is the one that is passed to the function.

Here is a simple example, just close - everything is fine, press a button and there will be a return code of 5. Code 5 is just because I decided so.

 from PyQt5 import Qt class Window(Qt.QWidget): def __init__(self): super().__init__() layout = Qt.QVBoxLayout(self) self.btn = Qt.QPushButton() layout.addWidget(self.btn) self.btn.clicked.connect(self.on_button) def on_button(self): Qt.QApplication.instance().exit(5) if __name__ == '__main__': app = Qt.QApplication([]) w = Window() w.show() result = app.exec() print(result) if result == 0: print("It's OK!") else: print("Something wrong! Button was pressed!")