# Incorrect method signature for addAttribute of qMRMLNodeComboBox?

**URL:** <https://discourse.slicer.org/t/incorrect-method-signature-for-addattribute-of-qmrmlnodecombobox/43015>\
**Category:** Development\
**Created:** [May 20, 2025, 11:10pm UTC](https://discourse.slicer.org/t/incorrect-method-signature-for-addattribute-of-qmrmlnodecombobox/43015 "2025-05-20T23:10:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [May 20, 2025, 11:10pm UTC](https://discourse.slicer.org/t/incorrect-method-signature-for-addattribute-of-qmrmlnodecombobox/43015/1 "2025-05-20T23:10:22Z")

</div>

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:

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

```

Output:

```auto
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?

```auto
>>> 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

```

> <https://github.com/Slicer/Slicer/blob/673ddca536801eedfdc3287dbc6ab110c494382c/Libs/MRML/Widgets/qMRMLNodeComboBox.h#L144-L146>

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [May 21, 2025, 9:04am UTC](https://discourse.slicer.org/t/incorrect-method-signature-for-addattribute-of-qmrmlnodecombobox/43015/2 "2025-05-21T09:04:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [May 21, 2025, 10:48am UTC](https://discourse.slicer.org/t/incorrect-method-signature-for-addattribute-of-qmrmlnodecombobox/43015/3 "2025-05-21T10:48:07Z")

</div>

> [@cpinter](#):
>
> 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.
