[PyQt] TypeError in QImage.loadFromData() in PyQt5.5.1

Phil Thompson phil at riverbankcomputing.com
Thu Nov 5 17:16:58 GMT 2015


On 5 Nov 2015, at 4:50 p.m., Milorad Pop-Tosic <pop at hiri.com> wrote:
> 
> Hi all,
> 
> Our tests detected a possible regression in QImage.loadFromData() after we switched from PyQt 5.4.1 to 5.5.1.
> This snippet demonstrates the problem:
> 
> from PyQt5.QtGui import QImage
> image = QImage()
> image.loadFromData('abc')
> 
> On PyQt5.5.1 this fails with:
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: arguments did not match any overloaded call:
>   QImage.loadFromData(str, str format=None): argument 1 has unexpected type 'str'
>   QImage.loadFromData(QByteArray, str format=None): argument 1 has unexpected type 'str'
> 
> On PyQt5.4.1 it works fine.
> 
> Environment:
> Python 3.4.2 on Windows in both cases.

http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html#pyqt-v5-5

However there is a SIP bug which means that the above exception message is misleading - it should say 'bytes' rather than 'str'.

Phil


More information about the PyQt mailing list