Home Website Youtube GitHub

channelWrangler apply config from script fails due to attributeError

mgear 2.6.1
running:

import mgear.maya.rigbits.channelWrangler as channelWrangler   
channelWrangler.applyChannelConfig("E:/01_production/assets/char/characterA/rig/data/faceUI.cc")

results in:

Error: AttributeError: file D:\Dropbox\maya\modules\mgear\scripts\mgear\maya\attribute.py line 292: 'unicode' object has no attribute 'name'` 

This should not happen? I could not find a reason why exactly this goes wrong. The cwc file seems to be valid.

Hi @fleity Thanks for the feedback, I will check this ASAP:

I have log it here: https://github.com/mgear-dev/rigbits/issues/8

Thanks,
Miquel

Hi Miguel,
as always thanks for the support :slight_smile:

The error occurs because isinstance(sourceNode, str) does only check if it’s type string but the sourceNode is stored as unicode therefore the pynode conversion never takes place.

mgear.maya.attribute line 279 - 285

if isinstance(sourceNode, str):
    sourceNode = pm.PyNode(sourceNode)
if isinstance(targetNode, str):
    targetNode = pm.PyNode(targetNode)

try:
    at = sourceNode.attr(attr)
    if pm.addAttr(at, q=True, usedAsProxy=True):
        pm.displayWarning("{} is a proxy channel and move operation is "
                          "not yet supported.".format(attr))

I changed

if isinstance(sourceNode, str):

to

if isinstance(sourceNode, str) or isinstance(sourceNode, unicode):

and everything works

1 Like

@fleity

Thanks also for this one!
I don’t know if you feel comfortable with git and github, but if you want to send a pull request with the fix. It will be super cool and very welcome! We need more contributors :wink:

Just let me know!

Cheers,
Miquel