[PySide] Help with resource files

Sean Fisk sean at seanfisk.com
Tue Apr 9 03:18:51 CEST 2013


On Monday, April 8, 2013 at 7:26 PM, Eric Johnson wrote:
> Sean Fisk <sean <at> seanfisk.com (http://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?
No, there isn't! I added that to mine as well and it worked great. Having to open the file like that isn't the most intuitive interface, but I should probably read the docs a little closer too.

Thanks for the help!
> 
> Eric
> 
> 
> 
> 
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org (mailto:PySide at qt-project.org)
> http://lists.qt-project.org/mailman/listinfo/pyside
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130408/b295becc/attachment.html>


More information about the PySide mailing list