The following Maya command xform when passed an invalid flag displays a detailed error:
CODE
cmds.xform(who=[3,4,3])
# Error: Invalid flag: who
# Traceback (most recent call last):
# File "", line 1, in
# TypeError: Invalid flag: who #
With the same command, but passing the wrong argument also displays a detailed error:
CODE
cmds.xform(t=[3,4,'doctor'])
# Error: Invalid arguments for flag 't'. Expected ( distance, distance, distance ), got [ int, int, str ]
# Traceback (most recent call last):
# File "", line 1, in
# TypeError: Invalid arguments for flag 't'. Expected ( distance, distance, distance ), got [ int, int, str ] #
Trying to reproduce the error Message in Python when creating a custom command using OpenMayaMPx.MPxCommand. The following line causes the error when passing the wrong argument/flag:
CODE
OpenMaya.MArgDatabase(self.syntax(), args)
Can't seem to catch the results of the error to display a detailed message to the user.
Is it possible to display a detailed error message for a custom Python command or is it a C++ thing?
-Nihilists