I learned that PyQt silences the error, and this issue can be resolved by rewriting sys.excepthook
. Moreover, I have consulted this two posted link1 and link2, both of which are about the same issue.
However, I could not figure out what sys.excepthook
does and how to transfer other`s solution to solve my own problem. Hopefully, you guys can shed me some light on this.
I have class Model
with function,
def updateFilename(self, filename):
if filename is None:
raise type_exc.PathIsEmpty("You have not chosen any file yet")
else:
self._filename = filename
And then, in another file,
def encodeVideo(self):
try:
self.model.updateFilename(self.fileName)
except type_exc.PathIsEmpty as e:
self.errorDialog.errorTypeChanged(e)
self.errorDialog.show()
My intention is to use try except
as usual, and activate an error displaying dialog when error occurs. But what my code really does, is autonomously exiting when an error takes place.