[PyQt] Missing QIODevice::read overloads

Florian Bruhin me at the-compiler.org
Mon May 25 21:40:54 BST 2015


Hi,

I noticed the following QIODevice overloads are missing in PyQt:

    qint64 QIODevice::read(char * data, qint64 maxSize)
    qint64 QIODevice::readLine(char * data, qint64 maxSize)

only the following are available:

    QByteArray QIODevice::read(qint64 maxSize)
    QByteArray QIODevice::readLine(qint64 maxSize = 0)

The issue with those is that it's impossible to check for errors:

    This function has no way of reporting errors; returning an empty
    QByteArray can mean either that no data was currently available
    for reading, or that an error occurred.

The best workaround I found so far is to check if
QIODevice::errorString is "Unknown error", but that's a hack...

Maybe PyQt should provide the two other forms as well, when passing a
mutable byte object (QByteArray/bytearray?) as first parameter?

Thanks,

Florian

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


More information about the PyQt mailing list