I've created small app with model and view. Since the beginning PyQt5 crash each time something went wrong with
Process finished with exit code -1073740791 (0xC0000409)
Its extremely cryptic. I don't know which component failed. For some time I was able to solve this problem with debugging, but something failed and I don't know what.
How to get call stack from PyQt5? How to get more verbose crash messages?
Python 3.6.1
PyQt5 5.8.1
PyCharm
Managed to fix it by rolling back your NVIDIA Driver to the previous version. I was on version 378.49 and switched back to 376.33 and now everything works fine. You can give that a try regardless of your graphics card.
Example with GTX 965M:
Go to Device Manager -> Display adapters -> NVIDIA GeForce GTX 965M
(Right Click) -> Properties -> Driver tab -> Roll Back Driver.
Note:
There is a new version of the Nvidia driver (378.66).
Comparing to the driver from guru3d - you have the driver from the original vendor and with newest fixes. :)
I have tested this version on my laptop (with GeForce GTX 960M).
It starts, works and finishes with exit code 0 on the environment console.
It seems to be ok now.
Here is what Nvidia changed since the buggy (378.49) version of their driver:
(taken from http://us.download.nvidia.com/Windows/378.66/378.66-win10-win8-win7-notebook-release-notes.pdf, page 15)
Updated:
I have dealt with the same problem, and the answer is twofold:
- The reason it's crashing could be any number of things. It's probably a programming bug, calling a function that doesn't exist, passing a widget instead of a layout, etc. But since you're not getting the useful output you don't know where to look for the culprit.
- PyQT raises and catches exceptions, but doesn't pass them along. Instead, it just exits with a status of 1 to show an exception was caught.
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")