Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems using PyQt's Resource System

Tags:

python

pyqt

pyqt4

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?

like image 374
David Davidson Avatar asked Dec 02 '22 06:12

David Davidson


1 Answers

pyrcc generates Python 2.x code by default.

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

like image 138
Dave Bailey Avatar answered Dec 05 '22 05:12

Dave Bailey