David Davidson
David Davidson

Reputation: 53

Problems using PyQt's Resource System

I am trying to use PyQt's Resource System but it appears I have no clue what I am doing! I already have to application created, along with its GUI I am just trying to import some images to use with the program.

I used the QtDesigner to create the resource file and I compiled it using pyrcc4.exe. But when I attempt 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?

Upvotes: 4

Views: 4985

Answers (1)

Dave Bailey
Dave Bailey

Reputation: 191

pyrcc generates Python 2.x code by default.

Try regenerating your resource files using pyrcc with flag '-py3'

Upvotes: 19

Related Questions