ID 350771 - Script Editor GUI does not print first line when printing from custom UI

Follow

Problem summary
Within the Script Editor, when creating custom UIs with PySide2, if the script is made to print a statement after closing the window, it will not appear until the Script Editor is refreshed.

This appears to be a Mac only issue, entering Nuke in Nuke11.0 and Nuke11.1

This is a GUI issue, the value is printed, it just does not appear until refreshed.
This only happens on the first line printed out the GUI, if a print statement has a new line '\n' call, the second line will print as expected.

Example of the issue:



Customer reported version

Customer reported platform

Steps to reproduce

1) Open Nuke11.0 or Nuke11.1

2) Copy/Paste and run the following in the script editor:
from PySide2 import QtWidgets
class PrintTestWindow(QtWidgets.QWidget):
'''Main GUI for the version sync app'''
def __init__(self, parent=None):
super(PrintTestWindow, self).__init__(parent)
self.initUI()
self.connectSignals()
        
def __syncVersions(self):
print 'Line 1 \nLine 2' # <'Line 1' does not get printed until refreshed
print 'Line 3'

self.close()

def connectSignals(self):
self.btnBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self.__syncVersions)
self.btnBox.rejected.connect(self.close)

def initUI(self):
# layouts
mainLayout = QtWidgets.QVBoxLayout()
self.setLayout(mainLayout)
self.btnBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Apply | QtWidgets.QDialogButtonBox.Cancel)
mainLayout.addWidget(self.btnBox)

mainWindow = PrintTestWindow()
mainWindow.show()

3) If 'Line 1' appears, run the code again.

Result: 'Line 1' will not appear in the Script Editor, yet 'Line 2' and 'Line 3' will exist.


Workaround
Within your script, print a new line '\n' for your first print statement.


Reproduced by support

This bug has been reproduced in:
Nuke11.1v3 - Mac10.13

Nuke11.1v1 - Mac10.13

Nuke11.0v4 - Mac10.13

Nuke11.0v1 - Mac10.13


Unable to reproduce bug in:
Nuke11.1v3 - Windows 7 - CentOS6.9


Earliest version tested
- This issue no longer appears in this version and has regressed ( PySide2 released with Nuke11.0 )


Expected behaviour
The first print statement line should appear in the Script Editor GUI


Actual behaviour
The first print statement does not appear until the Script Editor GUI is refreshed.


    We're sorry to hear that

    Please tell us why