cannot convert memoryview to QByteArray

Phil Thompson phil at riverbankcomputing.com
Mon Sep 2 17:24:54 BST 2024


On 01/09/2024 10:09, Kovid Goyal wrote:
> Converting a memoryview created froma  bytes object to QByteArray 
> fails:
> 
> python -c 'from PyQt6.QtCore import QByteArray; 
> QByteArray(memoryview(b"a"))'
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
> BufferError: memoryview: cannot cast to unsigned bytes if the format
> flag is present

Hmm, not sure why I couldn't reproduce this initially.

I think it's a Python bug...

https://github.com/python/cpython/issues/123609

...so I'll wait to see the response to that.

Phil


More information about the PyQt mailing list