2018.5 'str' object is not callable in MASH_QLineEditExtend (repro case)

2018.5 'str' object is not callable in MASH_QLineEditExtend (repro case)

Narann
Participant Participant
695 Views
0 Replies
Message 1 of 1

2018.5 'str' object is not callable in MASH_QLineEditExtend (repro case)

Narann
Participant
Participant

Open Maya:

 

from Qt.QtWidgets import QApplication

for m in QApplication.instance().allWidgets():
    print m.objectName()

This code is legit as QObject.objectName()  is the property to get the object name: https://doc.qt.io/archives/qt-4.8/qobject.html#objectName-prop

 

But if the MASH_Distribute tab is open in the Attribute editor, it raise an exception:

 

# Error: 'str' object is not callable
# Traceback (most recent call last):
#   File "<maya console>", line 11, in <module>
# TypeError: 'str' object is not callable # 

plug-ins/MASH/scripts/MASHsingleOutputQtWidget.py

 

In the class MASH_QLineEditExtend:

 

self.objectName = "MASH_DropZone"

You should fix this:

 

self._objectName = "MASH_DropZone"

Please prefix your internal members with undescore to avoid clash in Python. Only exposed member shouldn't have underscore.

 

Thanks in advance.

 

Our ugly workaround:

 

# MASH Distribute attribute editor has some widgets which
# redefine objectName to be a str instead of method
if not callable(m.objectName):
    continue
0 Likes
696 Views
0 Replies
Replies (0)