import maya.cmds as cmds
import maya.OpenMaya as om
#Errors
print("start")
cmds.error("This is an error") # the procedure will be interrupted
print("end")# the end will not be printed
print("start")
om.MGlobal.displayError("This is a displayError") # the code will not be interrupted
print("end")
#Warning
cmds.warning("This is a warning")
om.MGlobal.displayWarning("This is a displayWarning")
# Info
print("This is print statement")
om.MGlobal.displayInfo("This is a displayInfo") # the Info will be displayed in maya
import maya.cmds as cmds
import maya.OpenMaya as om
sel = cmds.ls(sl=True)
num_sel = len(sel)
if num_sel >= 2:
for s in sel:
print(s)
elif num_sel == 1:
om.MGlobal.displayError("Please select at least two objects")
else:
om.MGlobal.displayError("no object selected")