Copied from my support ticket here for visibility : -
On further investigation, the problem is due to this line :
QtGui.QPixmap(file)
In Nuke 12.2v6 this is crashing Nuke.
To test, you can start a SG Nuke shell environment (add “-t” to the software entity args so you can launch directly in to a shell. I’m using the following linux path in my software entity : “gnome-terminal -t “Nuke 12.2v7” – /apps/foundry/nuke/Nuke12.2v7/Nuke12.2 -t”
Once in a shell, if you run the following, the nuke session will crash.
"
from sgtk.platform.qt import QtGui
path=""
QtGui.QPixmap(path)
"
Running the same code in a GUI session of nuke does not crash Nuke.
This is replicating the logic found in : tk-multi-publish2/item.py at master · shotgunsoftware/tk-multi-publish2 · GitHub _validate_image() method.
So, the first thing this method does is to check if qt pixmap is available.
In the _validate_image() method, you’ve wrapped some code in a try/except to attempt to get QtGui.QPixmap to return an icon. It looks like even in a try/except, the calls you are doing are causing Nuke to crash out with a hard exit.
What it does is first attempt to get QtGui from sgtk.platform.qt:
from sgtk.platform.qt import QtGui
Then it gets the object
QtGui.QPixmap
In my shell environment, this is successful, so the exception is skipped.
The code then goes on to the “else” section… where it first checks for a QApplication instance with
QtGui.QApplication.instance()
In my session this returns the instance.
So, this method returns True for _qt_pixmap_is_usable.
So, back to _validate_image() method. We get QtGui again,
from sgtk.platform.qt import QtGui
Then attempt in a try/except to get the icon:
icon = QtGui.QPixmap(path)
It’s this line that crashes nuke out.
Assuming the init method might be the problem, I tested creating an empty pixmap. This works, but when I try to load in the image, it crashes nuke again.
QtGui.QPixmap().load(path)
This is all in a centos7 environment.
Doing “pip list” shows PySide 1.2.4 installed in my environment.
I’ve tested on Nuke11.3v3, 12.2v6 and 12.2v7.
I guess this is a Qt bug, but for shell publishing, this problem should be caught in the publisher code.
Any suggestions on how to fix this?