[PyQt] PyQt 5.5 gives TypeError: invalid result type from model.roleNames()

Nenad Ognjanovic bgr.gyk at gmail.com
Mon Jul 13 12:26:44 BST 2015


Thanks, wasn't aware of that change.

On Fri, Jul 10, 2015 at 6:40 PM, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> On 08/07/2015 5:50 pm, Nenad Ognjanovic wrote:
>>
>> Hello,
>> I've tried out the latest snapshots of PyQt and SIP with Qt 5.5.0, and
>> I've been getting the following error that didn't happen in previous
>> versions:
>>
>> TypeError: invalid result type from my_model.roleNames()
>>
>> I've extracted the minimal example that reproduces the problem, I've
>> attached it to this email and as a gist here:
>> https://gist.github.com/bgr/0fd25c6808260e0b5d0a
>>
>> Is this a bug or are we now expected to wrap the dict into some kind
>> of JSValue wrapper or similar?
>
>
> It's a bug in your code, see...
>
> http://pyqt.sourceforge.net/Docs/PyQt5/deprecations.html#conversion-of-latin-1-strings-to-qbytearray
>
> ...you just need to use b"hello" rather than "hello".
>
> However I have made changes in tonight's SIP and PyQt5 snapshots so that the
> error now reads...
>
> TypeError: invalid result from DummyModel.roleNames(), a dict value has type
> 'str' but 'QByteArray' is expected
>
> ...which is hopefully more helpful.
>
>
> Phil
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


More information about the PyQt mailing list