convert QByteArray to bytes
-
wrote on 16 Nov 2020, 09:46 last edited by
Hello,
I need convert QByteArray to standart pythons bytes.
I try convert it but I recieve SIGSEGV.
//Python 3.7.3 , PySide2 5.13.2Can you please help me??
from PySide2.QtCore import QByteArray pba=b'\x00\x02' qba=QByteArray(b'\x00\x02') # convert=bytes(qba) # SIGSEGV print("pba typ:"+str(type(pba))+" val:"+str(pba)) print("qba typ:"+str(type(qba))+" val:"+str(qba)) print("Int pba:"+str(int.from_bytes(pba, byteorder="big", signed=True))) print("Int qba:"+str(int.from_bytes(qba, byteorder="big", signed=True))) #SIGSEGV
-
Hello,
I need convert QByteArray to standart pythons bytes.
I try convert it but I recieve SIGSEGV.
//Python 3.7.3 , PySide2 5.13.2Can you please help me??
from PySide2.QtCore import QByteArray pba=b'\x00\x02' qba=QByteArray(b'\x00\x02') # convert=bytes(qba) # SIGSEGV print("pba typ:"+str(type(pba))+" val:"+str(pba)) print("qba typ:"+str(type(qba))+" val:"+str(qba)) print("Int pba:"+str(int.from_bytes(pba, byteorder="big", signed=True))) print("Int qba:"+str(int.from_bytes(qba, byteorder="big", signed=True))) #SIGSEGV
wrote on 16 Nov 2020, 10:38 last edited by JonB@poucz said in convert QByteArray to bytes:
convert=bytes(qba) # SIGSEGV
print("Int qba:"+str(int.from_bytes(qba, byteorder="big", signed=True))) #SIGSEGV
Both of these work fine for me. Ubuntu 20.04, Python 3.8.5, Qt/PySide2 either 5.12.8 or 5.15.0, not sure which (but I think the latter)!
-
wrote on 19 Nov 2020, 12:52 last edited by
Thank you,
after update it working!!
Amazing....sudo pip3 install -upgrade PySide2
3/3