Hi Python community.
I encounter a freeze testing PySide.
Reproduce bug.
Copy past the content of the jointed file in a Python script editor and
execute it.
This create a new pane using:
Pane/Test Table Panel
Now nuke freeze (CPU 100%) with this backtrace:
#0 0x00007f191cef1f6a in google::dense_hashtable<std::pair<void const*
const, SbkObject*>, void const*, std::tr1::hash<void const*>,
google::dense_hash_map<void const*, SbkObject*, std::tr1::hash<void
const*>, std::equal_to<void const*>, std::allocator<SbkObject*>
>::SelectKey, google::dense_hash_map<void const*, SbkObject*,
std::tr1::hash<void const*>, std::equal_to<void const*>,
std::allocator<SbkObject*> >::SetKey, std::equal_to<void const*>,
std::allocator<SbkObject*> >::find(void const* const&) () from
/u/soft/foundry/nuke6.3v5/libshiboken-python2.6.so.1.0
#1 0x00007f191cef1f94 in google::dense_hash_map<void const*,
SbkObject*, std::tr1::hash<void const*>, std::equal_to<void const*>,
std::allocator<SbkObject*> >::find(void const* const&) () from
/u/soft/foundry/nuke6.3v5/libshiboken-python2.6.so.1.0
#2 0x00007f191ceefebf in Shiboken::BindingManager::retrieveWrapper(void
const*) () from /u/soft/foundry/nuke6.3v5/libshiboken-python2.6.so.1.0
#3 0x00007f1901dfcb23 in QHBoxLayoutWrapper::metaObject() const () from
/u/soft/foundry/nuke6.3v5/plugins/PySide/QtGui.so
#4 0x00007f191bbd7459 in QMetaObject::cast(QObject*) const () from
/u/soft/foundry/nuke6.3v5/libQtCore.so.4
#5 0x00007f191c110431 in QLayout::parentWidget() const () from
/u/soft/foundry/nuke6.3v5/libQtGui.so.4
#6 0x00007f191c112793 in QLayout::addChildLayout(QLayout*) () from
/u/soft/foundry/nuke6.3v5/libQtGui.so.4
#7 0x00007f191c0f196a in QBoxLayout::insertLayout(int, QLayout*, int)
() from /u/soft/foundry/nuke6.3v5/libQtGui.so.4
#8 0x00007f1901bc3be1 in Sbk_QBoxLayoutFunc_addLayout () from
/u/soft/foundry/nuke6.3v5/plugins/PySide/QtGui.so
#9 0x00007f191d331c95 in PyEval_EvalFrameEx (f=0x3f010c0,
throwflag=<value optimized out>) at Python/ceval.c:3750
#10 0x00007f191d3332d0 in PyEval_EvalCodeEx (co=0x2181918,
globals=<value optimized out>, locals=<value optimized out>, args=0x2,
argcount=1,
kws=0x0, kwcount=0, defs=0x3ea53a8, defcount=1, closure=0x0) at
Python/ceval.c:3000
#11 0x00007f191d2db8cd in function_call (func=0x24d17d0, arg=0x3ea5490,
kw=0x0) at Objects/funcobject.c:524
#12 0x00007f191d2c4418 in PyObject_Call (func=0x24d17d0, arg=0x3ea5490,
kw=0x0) at Objects/abstract.c:2492
#13 0x00007f191d2cb62f in instancemethod_call (func=<value optimized
out>, arg=0x3ea5490, kw=0x0) at Objects/classobject.c:2579
#14 0x00007f191d2c4418 in PyObject_Call (func=0x2357460, arg=0x1fe3050,
kw=0x0) at Objects/abstract.c:2492
#15 0x00007f191d30afac in slot_tp_init (self=<value optimized out>,
args=0x1fe3050, kwds=0x0) at Objects/typeobject.c:5633
#16 0x00007f191d306238 in type_call (type=<value optimized out>,
args=0x1fe3050, kwds=0x0) at Objects/typeobject.c:740
#17 0x00007f191d2c4418 in PyObject_Call (func=0x3ef0db0, arg=0x1fe3050,
kw=0x0) at Objects/abstract.c:2492
#18 0x00007f191d32cc37 in PyEval_EvalFrameEx (f=0x3f03c30,
throwflag=<value optimized out>) at Python/ceval.c:3968
#19 0x00007f191d3332d0 in PyEval_EvalCodeEx (co=0x245c210,
globals=<value optimized out>, locals=<value optimized out>,
args=0x3ea5468, argcount=1,
kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at
Python/ceval.c:3000
#20 0x00007f191d2db8cd in function_call (func=0x23de320, arg=0x3ea5450,
kw=0x0) at Objects/funcobject.c:524
#21 0x00007f191d2c4418 in PyObject_Call (func=0x23de320, arg=0x3ea5450,
kw=0x0) at Objects/abstract.c:2492
#22 0x00007f191d2cb62f in instancemethod_call (func=<value optimized
out>, arg=0x3ea5450, kw=0x0) at Objects/classobject.c:2579
#23 0x00007f191d2c4418 in PyObject_Call (func=0x2357550, arg=0x1fe3050,
kw=0x0) at Objects/abstract.c:2492
#24 0x00007f191d32aee6 in PyEval_CallObjectWithKeywords (func=0x2357550,
arg=0x1fe3050, kw=0x0) at Python/ceval.c:3619
#25 0x0000000000c38368 in ?? ()
#26 0x0000000000bb6ae8 in ?? ()
#27 0x0000000000bb5feb in ?? ()
#28 0x0000000000c82254 in ?? ()
#29 0x00007f191d331c95 in PyEval_EvalFrameEx (f=0x38ca900,
throwflag=<value optimized out>) at Python/ceval.c:3750
#30 0x00007f191d3322aa in PyEval_EvalFrameEx (f=0x38ca730,
throwflag=<value optimized out>) at Python/ceval.c:3836
#31 0x00007f191d3332d0 in PyEval_EvalCodeEx (co=0x2458f30,
globals=<value optimized out>, locals=<value optimized out>, args=0x2,
argcount=1,
kws=0x3899d40, kwcount=0, defs=0x245b768, defcount=1, closure=0x0)
at Python/ceval.c:3000
After some search, this is related to the line 25 of my given script:
filterLay.addLayout(filterLay)
I suppose there is a problem as Python go into an infinite loop and
should just raise Exception no? Am I wrong?
Regards,
Dorian
import nuke
import PySide.QtCore as QtCore
import PySide.QtGui as QtGui
from nukescripts import panels
class NukeTestWindow(QtGui.QWidget) :
def __init__(self, parent=None) :
self.nodeDict = {}
QtGui.QWidget.__init__(self, parent)
self.setLayout(QtGui.QVBoxLayout())
# filter
filterLay = QtGui.QHBoxLayout()
self.filter_editLine = QtGui.QLineEdit()
self.filter_editLine.setToolTip("Use shift+backspace to clear the filter")
self.filter_editLine.textChanged.connect(self.updateListFromFilter)
self.filter_clearButton = QtGui.QPushButton("Clear")
self.filter_clearButton.clicked.connect(self.clearFilterLineEdit)
filterLay.addWidget(self.filter_editLine)
filterLay.addWidget(self.filter_clearButton)
#filterLay.addLayout(filterLay)
self.layout().addLayout(filterLay)
self.myList = QtGui.QListWidget()
self.layout().addWidget(self.myList)
self.myList.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
self.connect(self, QtCore.SIGNAL("nodeDictUpdated"), self.refreshNodeList)
self.refreshNodeDict()
def refreshNodeDict(self) :
self.nodeDict = {}
for node in nuke.allNodes() :
nodeName = node['name'].value()
self.nodeDict[nodeName] = node
self.emit(QtCore.SIGNAL("nodeDictUpdated"))
def clearFilterLineEdit(self) :
self.filter_editLine.clear()
def refreshNodeList(self) :
for nodeName in self.nodeDict.keys() :
self.myList.addItem(nodeName)
def updateListFromFilter(self, *args) :
self.myList.clear()
# prepare re text
filterText = args[0]
filterText = filterText.replace("*",".*")
# prepar re object
regexStr = "^%s.*$" % filterText.lower()
regex = QtCore.QRegExp(regexStr)
regex.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
for nodeName in self.nodeDict.keys() :
if regex.exactMatch(nodeName) :
self.myList.addItem(nodeName)
panels.registerWidgetAsPanel('NukeTestWindow', 'Test table panel', 'uk.co.thefoundry.NukeTestWindow')
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python