[PySide] Help with resource files

Eric Johnson hardware at darcygirl.com
Tue Apr 9 01:26:57 CEST 2013


Sean Fisk <sean <at> seanfisk.com> writes:

> 
> OK, I have an interim solution. While I do believe that QFile.readAll() should
> return the file contents as a QByteArray, QResource.data() seems to work! 
> Here is the code: 

I tested it at home on OS X 10.8.2 using the builtin Python and Qt 4.8.1, 
PySide 1.1.1 and it works once I opened the file with
    test_txt.open(QtCore.QIODevice.ReadOnly | QtCore.QIODevice.Text)

Output is:
    Running PySide 1.1.1 / Qt 4.8.1
    PySide compiled with Qt 4.8.1
    Does it exist?: True
    readAll(): `This is just a test.
    '

Is there a good reason you aren't opening the file?

Eric







More information about the PySide mailing list