Go to: Synopsis. Return value. Keywords. Related. Flags. Python examples.

Synopsis

warning([showLineNumber=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

warning is NOT undoable, NOT queryable, and NOT editable.

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).

Return value

None

Keywords

debug, information, echo

Related

error

Flags

showLineNumber
Long name (short name) Argument types Properties
showLineNumber(sl) boolean create
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 command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

import maya.cmds as cmds
def lightWarning():
    l = cmds.ls( lights=True )
    if len(l) == 0:
        cmds.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 #
#