[PyQt] Problem with QDataStream and QString

İsmail Dönmez ismail at namtrac.org
Fri Apr 11 12:13:55 BST 2008

Hi again,

Looks like I am back to QDataStream problems and here is the testcase :

>>> from PyQt4.QtCore import *
>>> a = QByteArray()
>>> b = QDataStream(a, QIODevice.ReadWrite)
>>> b << QString("123")
<PyQt4.QtCore.QDataStream object at 0xa77e8e2c>
>>> b.device().seek(0)
>>> b.readString()

I was expecting the last output to be "123" instead of empty string.
Any idea what I am doing wrong here?


Never learn by your mistakes, if you do you may never dare to try again.

More information about the PyQt mailing list