State:New|TargetRelease:No Target|icon_bug|icon_nuke|database:public|Resolution:Fixed|BugID:600907|
Problem summary
Error/warning popups on script open cause the <script>.nk is for nuke<version>; this is nuke<version> warning to not appear.
This can happen with both Nuke's standard errors/warnings but also when creating a custom popup dialog with an onScriptLoad callback.
Customer reported version
Nuke 13.2v8
Customer reported platform
Windows 10
Steps to reproduce
1) Download the attached .zip and add swap the contained .nuke with your current one.
2) Open the .nk script.
NOTE: The issue also happens without installing the custom .nuke folder.
Instead of Input already correct, you will just see a name '<module>' not defined error instead.
Alternative steps to reproduce
1) Add the following code to your menu.py file:
import nukeif nuke.NUKE_VERSION_MAJOR < 16: from PySide2.QtWidgets import QMessageBoxelse: from PySide6.QtWidgets import QMessageBoxdef show_alert(): "Hello world" msg = QMessageBox() msg.setIcon(QMessageBox.Warning) msg.setText("custom error message popup\nQMessageBox.exec_()") msg.exec_()
2) Open Nuke.
3) Open a .nk script from a newer Nuke version than your current Nuke version.
This issue is reproducible with many different methods for creating the popup. Replace the show_alert()function in your menu.py with one of the functions below, and repeat the steps above:
def show_alert(): "Hello world" nuke.alert("custom error message popup\nnuke.alert()")def show_alert(): "Hello world" nuke.message("custom error message popup\nnuke.message()")def show_alert(): "Hello world" QMessageBox.information(None, "Nuke", "custom error message popup\nQMessageBox.information()")def show_alert(): "Hello world" QMessageBox.warning(None, "Nuke", "custom error message popup\nQMessageBox.warning()")def show_alert(): "Hello world" raise ValueError("custom error message\nValueError")
Expected behaviour
The default <script>.nk is for nuke<version>; this is nuke<version> warning should display the correct message.
Actual behaviour
Instead of <script>.nk is for nuke<version>; this is nuke<version>, the warnings message just shows the name of the Viewer:
However, if you raise a ValueError instead, the warning message does not appear at all. This also happens with Nuke's default warnings/errors messages:
def show_alert(): "Hello world" raise ValueError("custom error message\nValueError")
Workaround
You can use a QTimer to delay your popup from appearing, which preserves the default <script>.nk is for nuke<version>; this is nuke<version> warning. For example:
import nukeif nuke.NUKE_VERSION_MAJOR < 16: from PySide2.QtWidgets import QMessageBox from PySide2.QtCore import QTimerelse: from PySide6.QtWidgets import QMessageBox from PySide6.QtCore import QTimerdef show_alert(): "nuke's corrupt error message" msg = QMessageBox() msg.setIcon(QMessageBox.Warning) msg.setText("custom error message popup\nQMessageBox.exec_()") msg.exec_()def delay_alert(): QTimer.singleShot(1, lambda: show_alert())nuke.addOnScriptLoad(delay_alert)
Reproduced by support
This bug has been reproduced in:
Nuke 16.0v3 - Windows 11 - macOS 15 (Sequoia)
Nuke 12.0v1 - Windows 11 - macOS 12 (Monterey)
Earliest version tested
Nuke 12.0v1
- This issue appears to be in all tested versions of the product
We're sorry to hear that
Please tell us why