show message in command line by python

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 07 July 2013   #1
show message in command line by python

how could we create a message for command line?
__________________
welcome to the world of imagination
 
Old 07 July 2013   #2
import maya.cmds as cmds
cmds.error('Error!')
 
Old 07 July 2013   #3
Doesn't the error command also stop the execution of the script?
Use print instead if you just want to echo out something that is happening in the script.
__________________
Nightshade UV Editor (script for Maya) - Extends Maya's default UV Texture Editor with additional tools.
 
Old 07 July 2013   #4
Use the MGlobal class from OpenMaya. You can display info, warnings and errors to the Command Line without interrupting your code execution:

import maya.OpenMaya as om

om.MGlobal.displayInfo("your text here")
om.MGlobal.displayWarning("your warning here")  # Yellow background
om.MGlobal.displayError("your error here")  # Red background

-ChrisZ
 
Old 07 July 2013   #5
You can use standard python logger configured for console output. See python logging library for more details.
 
Old 07 July 2013   #6
put a comma at the end of the print line
__________________

 
Old 07 July 2013   #7
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:03 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.