grayOlorin
2015年2月20日 15:30:40
Hey guys, has anyone seen this weird issue, where when writing some python code in a python module such as:
import maya.cmds as cmds
print cmds.ls(sl=True)
returns this error:
Flag ‘sl’ must be passed a boolean argument
there appears to be something strange going on with the True keywork flag which I cannot seem to figure out… using 1 instead yields the same result
awong
2015年2月21日 12:19:42
Ah, another user actually reported the same issue. It took a while to hunt down the problem. That error message is actually not the real error, so it's misleading. The real problem comes from a limitation of Maya's cmd module. There are two workarounds. One is to simply use the mel equivalent.
The other workaround is to is disable asynchronous mode in the Maya plugin. I recently added a preference to specifically workaround this issue. However, by turning off asynchronous mode, you lose some nice features like progress bar and interrupts. :?
grayOlorin
2015年2月21日 13:10:14
Thank you so much Andrew! You are a life saver!
Would using pymel also resolve the issue?
awong
2015年2月21日 20:00:46
I think many parts of pymel still uses the cmd module underneath. So it'd probably suffer from the same problems.