Attributes 'qRegisterResourceData' and 'qUnregisterResourceData' in QT6 library

945 Views Asked by At

I am trying to compile a Python application written for Python2 under MacOs (Monterey) with M1 (ooph!).

  1. Instead of Python 2 I am using Python 3 (3.8.9)
  2. Instead of QT5 I have to use QT6 (QT5 refuses to install with different pip versions and different versions of QT5)

Having substituted lines like from PyQt5 import QtCore to from PyQt6 import QtCore, I finally stuck with the following error trying start the application:

  File "pyjtt_res_rc.py", line 14407, in qInitResources
    QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
AttributeError: module 'PyQt6.QtCore' has no attribute 'qRegisterResourceData'

according to the comment, this file is a # Resource object code and contains basically

from PyQt6 import QtCore

qt_resource_data = b"\
\x00\x00\x15\x46\
....
"

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()

I believe something has been changed in QT6 and now I have to use other attributes or these attributes are now located in other module.

Any ideas what to do?

1

There are 1 best solutions below

1
forkintheass On BEST ANSWER

Resources control module has been removed from QT6. Deprecate these two functions from the code and also remove additional call of qInitResources(). It and all will work.