[PyQt] UnicodeDecodeError with output from Windows OS command

Florian Bruhin me at the-compiler.org
Thu Nov 30 11:24:33 GMT 2017


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()
    ''

Florian

-- 
https://www.qutebrowser.org  | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072  | https://the-compiler.org/pubkey.asc
         I love long mails!  | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20171130/5881350d/attachment.sig>


More information about the PyQt mailing list