[PyQt] UnicodeDecodeError with output from Windows OS command
Valentin Valls
valentin.valls at esrf.fr
Thu Nov 30 14:42:40 GMT 2017
On 11/30/2017 12:24 PM, Florian Bruhin wrote:
> On Thu, Nov 30, 2017 at 12:12:17PM +0100, Valentin Valls wrote:
>> stream = qt.QDataStream(byte_array, qt.QIODevice.ReadOnly)
>> my_string = stream.readQString()
> This really isn't what a QDataStream is for... and I don't see how it could
> work. For me, it doesn't:
>
> >>> from PyQt5 import QtCore
> >>> ba = QtCore.QByteArray(b'hello')
> >>> s = QtCore.QDataStream(ba, QtCore.QIODevice.ReadOnly)
> >>> s.readQString()
> ''
If you don't use QDataStream to write your data i don't see why you try
to use it to read.
Regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: valentin_valls.vcf
Type: text/x-vcard
Size: 293 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20171130/c57069d2/attachment.vcf>
More information about the PyQt
mailing list