pymel.core.system.warning¶
- warning(*args, **kwargs)¶
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).
Flags:
Long Name / Short Name Argument Types Properties noContext / n bool Do not include the context information with the warning message. 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 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 # #