Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Pyside-rcc Generates Invalid Python



  • Hi There,

    I am new to PySide (lovin' it!), and I am trying to design a UI in Qt Designer, then use the tools to convert the .ui and .qrc files to Python code. When I do this for a simple application with one icon (a .png file), the code that pyside-rcc.exe generates is invalid. It looks like the following:

    @# -- coding: utf-8 --

    Resource object code

    Created: Mon Jul 4 17:28:41 2011

    by: The Resource Compiler for PySide (Qt v4.7.3)

    WARNING! All changes made in this file will be lost!

    from PySide import QtCore

    qt_resource_data = "\x00\x00\x03\x1f\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\x00\x09pHYs\x00\x00\x0d\xd7\x00\x00\x0d\xd7\x01B(\x9bx\x00\x00\x00\x19tEXtSoftware\x00www.inkscape.org\x9b\xee<\x1a\x00\x00\x02\x9cIDAT8\x8du\x93Oh\x14I\x14\xc6\xaf\xaa\xba\xbbz\xb2\x83{\x88\x1e\x8c \xea\xcea/\xe2EA\x85\x10\xd1\xabhP\xc3\xaa\xe4(\x1e\x0c,\x1a\x0f\x92\xbb.\x1e\xf6\xe0\x1f\x8c\xa0WEP/\x9eDP\x14$j\x04\x85\x15\x1c\xdd\x1dwB&l@g\xa2\xc9\xf4d:\x9d\xee\xa9=\xc4\x19\xff?\xf8\xa8z\x97\xaf~=\x9e\x1c\x1c\xdc2I\x92\x11~P"\x82\xef\xfb\xd8\xc0b\x8c\x01\x11\xb2,\xc5\x06\xf6\xcf\xb3g\xce\x9f0I\x92\x8c\xf4\xef\xdaC\xb9&\x8a"\x1a\x8d\x06\xcdf\x938\x8eI\xd3\x94\x0b\x17\xce\xa3\x94Bk\x83R\x0a\x80f\xdc\xe4\xec\xb93\xc3\xc0i\x03\x10\x04\x01A\x10\x90$\x09i\x9a\xd2j\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d\x18 \x9f\xcf\xa3\xb5&j\xd4Y\xfe\xfb\x10\xb2\xaa\x87\xd9\xbbw\x99\x9d\xfb&#x40;\xb5\xf6\x0e\xde\x00x\x9eG\xadV%Y`\xf3\xd6Mx\x9e\x8fs-\xe6\xea\xb3\x80|\xda\xccm\xbd\xfc\xbc\xad\x97\xf7\xefk\xcc\xcc\xcc,\x19\xf8\xbe\xea\xea\xb5+#\xb5Z\x15\x11a\xec\xd1\xd87\xeb\xfcu9\xe7\x08\x82\xe0\x0f \xfd\x1f?=\xfd]\x93\x00\xa5e\x00\x00\x00\x00IEND\xaeB`\x82"
    qt_resource_name = "\x00\x07\x07\xab\x06\x93\x00a\x00c\x00t\x00i\x00o\x00n\x00s\x00\x09\x0alxC\x00r\x00e\x00s\x00o\x00u\x00r\x00c\x00e\x00s\x00\x05\x004\xdbF\x001\x006\x00x\x001\x006\x00\x08\x0f\x07Z\xc7\x00e\x00x\x00i\x00t\x00.\x00p\x00n\x00g"
    qt_resource_struct = "\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\x00\x00\x00,\x00\x02\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00<\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00"
    def qInitResources():
    QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)

    def qCleanupResources():
    QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)

    qInitResources()@

    If I try to import this, I get:

    @ ^
    SyntaxError: unexpected character after line continuation character@

    This is due to the mismatched quotation marks. Am I doing something wrong here?

    Thanks,
    Mark.

    [EDIT: fixed code formatting, Volker]



  • this bug was reported on pyside bugzilla and have been already fixed.

    Thanks

    you can get more information on: http://bugs.pyside.org/show_bug.cgi?id=901



  • Thanks, Renato! Is there an easy way to get a patched version of the binary without having to rebuild PySide from source? I am not equipped to do that at the moment....

    Thanks,
    Mark.



  • We are planning a new release of pyside-tools for this week maybe today you can wait or you can use the previous version: http://www.pyside.org/files/



  • Thanks, Renato! The previous version works.

    I'm really enjoying experimenting with PySide by the way. I've been waiting a long time for this and it is exceeding my expectations. Awesome work, guys!

    Mark.


Log in to reply