[PyQt] qrc:/// not working to access resources?

Shriramana Sharma samjnaa at gmail.com
Mon Feb 3 04:30:45 GMT 2014

Hello. I'm using PyQt 4.10.3 with Qt 4.8.4 on Kubuntu Saucy.

As per my local Qt4 doc it is valid to access rcc-ed (and imported)
resources by just :/path/to/file or qrc:///path/to/file. As per the
examples at http://qt-project.org/doc/qt-5/resources.html it seems
qrc:/path/to/file is valid as well. However, on my system only :/ is
working and not the other two. Please see the following session with the
attached code:

$ ls
res.png  res.qrc  test.py
$ cat res.qrc
<!DOCTYPE RCC><RCC version="1.0">
$ pyrcc4 -py3 res.qrc -o res.py
$ cat test.py
#! /usr/bin/env python3
from res import *
from PyQt4.QtGui import QImage
i = QImage("qrc:///res.png")
i = QImage("qrc:/res.png")
i = QImage(":/res.png")
$ python3 test.py

Am I doing anything wrong? Please advise. Thank you.

Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140203/db2acaba/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qrc-test.zip
Type: application/zip
Size: 4260 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140203/db2acaba/attachment.zip>

More information about the PyQt mailing list