1


I'm using eclipse + pydev + python 3.4 + pyQt5.5
I have a strange issue, with no traceback or any other message when program crashes.
When I try to write error producing code in place that executes when programm initiates (like init method of MainWindow) i've got my standart traceback and everything is ok.
But when i put my bad code in some kind of callback(like method connected to QPushButoon clicked signal) and push that button, program crashes but my eclipse console window stays empty. No traceback, no error message, just nothing.
Do you have any suggestions?

Edit. Sample code:
For this type of code, application will crash on startup and I WILL get the traceback, and everything will be ok:

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        error_producing_string

And in this example application will crash on button click, but i won't get any error or traceback:

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.btn = QPushButton('text', self)
        self.button.clicked.connect(self.handleButton)

    def handleButton(self):
        error_producing_string

1 Answers1

1

Well, PyQt can really crash in some circumstances (it probably has nothing to do with PyDev)... even having exceptions inside a callback from qt may crash the application (so, you really have to treat qt code carefully).

The first thing here would be turning on faulthandler and see if it enables you to find something useful. If it doesn't, try stepping in the PyDev debugger until it crashes to see if you can get something useful from that... If you still can't get the reason, the next step would be getting a debug version of python/PyQt and debugging it in gdb or visual c++.

Also, you should probably take a look at What are good practices for avoiding crashes / hangs in PyQt? for good practices when dealing with PyQt.

Community
  • 1
  • 1
Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78
  • Tried to turn on fault handler (-X faluthandler), still no error messages, but console title now is " faulthandler" instead of " main.py". And in debug perspective and debug launch i got interactive console but still no stack trace or error message. – Mad.Lobster Jan 26 '16 at 08:13
  • Will try to check my qt code for bad practice or install debug versions – Mad.Lobster Jan 26 '16 at 08:14
  • And in debug i've noticed, that when it crashes in __init__ , it goes back through stack trace and thows all collected info to stderr, but in my button connected method it just jumps directly to **sys.exit(app.exec_())** – Mad.Lobster Jan 26 '16 at 08:30
  • And if I run my program from windows cmd, everything works just fine and I get my tracebacks from anywhere. Btw, thanks for reply) – Mad.Lobster Jan 26 '16 at 10:17
  • Well, do you have some sample code where I can see that? It's hard to know what may be happening without actually seeing the code... – Fabio Zadrozny Jan 27 '16 at 12:31