Problems Using PyQt Resource System

I'm trying to use the PyQt resource system, but it looks like I have no idea what I'm doing! I already have an application created along with its graphical interface. I'm just trying to import some images for use with the program.

I used QtDesigner to create a resource file, and I compiled it using the pyrcc4.exe file. But when I try to import the resource file, I get this error:

Traceback (most recent call last): File "C:\Projects\main.py", line 14, in <module> import main_rc File "C:\Projects\main_rc.py", line 482, in <module> qInitResources() File "C:\Projects\main_rc.py", line 477, in qInitResources QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) TypeError: argument 2 of qRegisterResourceData() has an invalid type 

What am I doing wrong?

+4
source share
1 answer

pyrcc generates Python 2.x code by default.

Try restoring resource files using pyrcc with the '-py3' flag

+18
source

All Articles