Custom Engine - loading Apps

Hi there,

i’m trying to write a very simple Custom Engine (tk-deadline) just to be able to access some SG Apps in our Render Farm Manager (Deadline). Deadline includes Python and PyQt5, so i thought it wouldn’t be such a big deal :wink:

I defined properties like:

def has_ui(self):
    return True

def has_qt5(self):
    return True

I added the new Engine to engine_locations.yml and created a settings file (tk-deadline.yml) which looks like:

- ../app_locations.yml
- ../engine_locations.yml
- ./tk-multi-daily.yml
    tk-multi-daily: ''
  location: ''

Last step to load the Engine was to define Engine in the environment file (i.e. shot_step.yml):

- ./includes/settings/tk-shotgun.yml

  tk-deadline: ""

And i added “tk-deadline” to the list of supported Engines of the belonging SG Apps (info.yml).

In the end everything seems to get loaded except QT. The log files shows me the following error:

AttributeError: 'NoneType' object has no attribute 'QWidget'

which comes from the app (tk-multi-daily):

from tank.platform.qt import QtCore, QtGui
class GeneralTab(QtGui.QWidget):
    def __init__(self, parent=None):
        super(GeneralTab, self).__init__()

There is no ImportError and the Engine gets also started without Errors in the right Context.
I tried pre import “from tank.platform.qt import QtCore, QtGui” in the function pre_app_init(), but it does not change anything.

Has anybody an idea why “QtGui” could be “None” and what i have change to load PyQt properly?

Many thanks


Hmm, for Qt 5, try using QWidgets instead

from tank.platform.qt5 import QtCore, QtWidgets
class GeneralTab(QtWidgets.QWidget):
    def __init__(self, parent=None):
        super(GeneralTab, self).__init__()

As far as I’m aware, there isn’t much testing done for PyQt5 officially since most DCC apps are using PySide*. Katana is using PyQt* and in case you run into any PyQt* errors with any apps, check the app’s GitHub Pull Request page to see if there are any fixes for it

Apart from the namespace import issue mentioned you might find that tk-core won’t support a PyQt5 based engine properly. I have a PR for tk-core to support PyQt5 that can be used. It’s been tested on a custom tk-katana engine.


You could also try bundle those and changes in your own engine too if you don’t feel like forking a separate copy of tk-core

See also:

1 Like

Thanks @j0yu and @Halil ! I will give it a try :nerd_face: