Incorrect method signature for addAttribute of qMRMLNodeComboBox?

Using Slicer Preview 5.9.0-2025-05-16

When calling a qMRMLNodeComboBox addAttribute with 2 input arguments I observe no error however the help method indicates there should be 3 input arguments:

node_combobox = slicer.qMRMLNodeComboBox()
node_combobox.setMRMLScene(slicer.mrmlScene)
node_combobox.nodeTypes = ["vtkMRMLMarkupsLineNode"]
print(help(node_combobox.addAttribute))

Output:

Help on builtin_qt_slot:

addAttribute(...)
    X.addAttribute(nodeType, attributeName, attributeValue)

None

The help() output appears to show 1 signature with 3 input arguments, but when I only give 1 input argument it warns that it has 2 signatures that accept either 2 or 3 input arguments.Is it getting confused that qMRMLNodeFactory has an addAttribute with 2 input arguments while qMRMLNodeComboBox has an addAttribute with 3 input arguments?

>>> node_combobox.addAttribute("MyAttributeName")
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ValueError: Could not find matching overload for given arguments:
('MyAttributeName',)
 The following slots are available:
addAttribute(QString nodeType, QString attributeName, QVariant attributeValue) -> void
addAttribute(QString nodeType, QString attributeName) -> void

This seems correct to me.

  • There is one function for adding attribute in the node combobox, which has three arguments
  • The help call shows you that
  • The last argument in the function has a default value, so theorically you can call it with giving two arguments
  • The error message listing the available variants finds this option

The only thing that I find strange is that help output and the error message are different.
Is this your problem?

Yes these outputs were producing two things.