Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setAttr with force flag not working #443

Open
Visherac opened this issue May 20, 2021 · 2 comments
Open

setAttr with force flag not working #443

Visherac opened this issue May 20, 2021 · 2 comments

Comments

@Visherac
Copy link

Using Maya2022, (pymel 1.2, python 3.7.7) Windows 64bit

REPRO

It appears that there is an issue with the setAttr not accepting ‘force’(‘f’) argument

Functionality that previously existed in pymel 1.09 with Maya2020

This is a core functionality in pymel (shown even in the example demo docs). Raising concerns with unknown how much other functionality didn’t quite make it over to the large python3 upgrade to pymel.

Repro Test Case
import pymel.core as pm
transform, shape = pm.polyCube()
transform.setAttr("foo", "bar", force = True)

Result

Traceback (most recent call last):

Error: Invalid arguments for flag 'ln'. Expected string, got ( str, str, str )

Traceback (most recent call last):

File "", line 3, in

File "C:\Program Files\Autodesk\Maya2022\Python37\lib\site-packages\pymel\core\nodetypes.py", line 747, in setAttr

return general.setAttr("%s.%s" % (self, attr), *args, **kwargs)

File "C:\Program Files\Autodesk\Maya2022\Python37\lib\site-packages\pymel\core\general.py", line 586, in setAttr

dt='string')

File "C:\Program Files\Autodesk\Maya2022\Python37\lib\site-packages\pymel\core\general.py", line 768, in addAttr

res = cmds.addAttr(*args, **kwargs)

File "C:\Program Files\Autodesk\Maya2022\Python37\lib\site-packages\pymel\internal\pmcmds.py", line 217, in addAttr_wrapped

res = new_cmd(*new_args, **new_kwargs)

TypeError: Invalid arguments for flag 'ln'. Expected string, got ( str, str, str )

Expected Result
Create a Cube object. Cube has a string attribute with longName = ‘foo’, value is set to ‘bar’.

Other Things worth Note.
Looking at the source code. Issue appears to be that
Pymel.util.nameparse.Attribute class is iterable in Python3 but not iterable in python2. This is causing problems with the pymel.internal.pmcmds.getMelRepresentation

@willDTF
Copy link

willDTF commented Oct 11, 2021

hello, Any news on this ?

@cbeintema
Copy link

I would also love to see this fixed as we use this quite a bit throughout our toolset. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants