The warning command is provided so that the user can issue warning messages from his/her scripts. The string argument is displayed in the command window (or stdout if running in batch mode) after being prefixed with a warning message heading and surrounded by the appropriate language separators (# for Python, // for Mel).
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
showLineNumber (sl) | bool | ||
Obsolete. Will be deleted in the next version of Maya. Use the checkbox in the script editor that enables line number display instead.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
Derived from mel command maya.cmds.warning
Example:
import pymel.core as pm
import maya.cmds as cmds
def lightWarning():
l = pm.ls( lights=True )
if len(l) == 0:
pm.warning( "No Lights" )
lightWarning()
#
# The above will produce the following output:
#
# # Warning: No Lights #
#
# When the option to show line numbers in errors is enabled the output will
# be the following:
#
# # Warning: line 4 of 'lightWarning' in '"maya console'": No Lights #
#