[PyQt] Qt5 error messages

Holger Jahn lists at loomsday.co.nz
Fri Sep 11 06:44:14 BST 2015


Hi,

Is there a way to determine the detailed error reason of a failed Qt5 
method call in PyQt5?

Here is what I am doing (Qt 5.5 and Python 3.4 on latest Arch Linux):

image = QImage()
image.load( '/does_absolutely_not_exist' )

Now, I would like somehow retrieve a "File not found!" error message 
within my script by some means. Instead, this is happening:

1) The call to above method does not bail out.

2) With "if not image.load( file_name ):" it is possible to control the 
programme flow, since "load()" simply returns Failed.

3) try:/except: does not work, "except:" is not triggered.

4) I even tried to install a "QtCore.pyqtSignal()" event handler, but 
the handler is also not triggered by the failing "load" method.

What am I missing here?

Many thanks,
Holger



More information about the PyQt mailing list