[PyQt] Absolute paths in qrc file.

Eric Frederich eric.frederich at gmail.com
Fri Jun 28 15:45:20 BST 2013


I'm having trouble working with absolute file paths in my qrc resource
file with PyQt.
Am I doing something wrong or is it just something that rcc happens to
support but not pyrcc4?

Here is my resource file

    $ cat resources.qrc
    <!DOCTYPE RCC><RCC version="1.0">
    <qresource>
    <file alias="filesaveas.png">/usr/share/icons/oxygen/32x32/actions/document-save-as.png</file>
    </qresource>
    </RCC>

When I invoke pyrcc4:

    $ pyrcc4 -o qrc_resources.py resources.qrc
    Cannot find file: /usr/share/icons/oxygen/32x32/actions/document-save-as.png
    No resources in resource description.

The file does exist:

    $ file /usr/share/icons/oxygen/32x32/actions/document-save-as.png
    /usr/share/icons/oxygen/32x32/actions/document-save-as.png: PNG
image data, 32 x 32, 8-bit/color RGBA, non-interlaced

Note: rcc works fine with this file:

    $ rcc resources.qrc -o resources.rcc
    $ wc -l resources.rcc
    199 resources.rcc


More information about the PyQt mailing list