supress warning message

479 views
Skip to first unread message

sberger

unread,
Jan 14, 2009, 10:28:41 AM1/14/09
to python_inside_maya
Hi, I am trying to suppress maya warning message, but the try:/except:
clause don't supress it.

Anyone know how to do this?

Here is a peice of code that repro the problem

import maya.cmds as cmds
circle_X = cmds.circle(c=(1.1,0,0), nr=(0,1,0), s=8)[0]
circle_Y = cmds.circle(c=(-1.1,0,0), nr=(0,1,0), s=8)[0]
try:
cmds.curveIntersect( circle_X, circle_Y ) #warning messages to
suppress ...
except:
pass

John Creson

unread,
Jan 14, 2009, 11:49:03 AM1/14/09
to python_in...@googlegroups.com
catchQuiet is built to do this, but is in mel only...
So use mel.eval
But it doesn't get to the except situation...
Though you can use it in mel to quiet an if...


import maya.cmds as cmds
import maya.mel as mel

circle_X = cmds.circle(c=(1.1,0,0), nr=(0,1,0), s=8)[0]
circle_Y = cmds.circle(c=(-1.1,0,0), nr=(0,1,0), s=8)[0]
try:
       mel.eval('catchQuiet ("curveIntersect  circle_X circle_Y")') #warning messages to suppress ...
except:
       pass

Sylvain Berger

unread,
Jan 14, 2009, 2:01:37 PM1/14/09
to python_in...@googlegroups.com
Thanks for the help... this is a good workaround, unfortunatly it's really messy to capture the command return in a python variable.

I think i'll live with the warnings

--
They say, "Evil prevails when good men fail to act." What they ought to say is, "Evil prevails."
Nicolas Cage as Yuri Orlov in Lord of War.

ynedelin

unread,
Jan 21, 2013, 1:27:37 PM1/21/13
to python_in...@googlegroups.com
hey guys
Did you happen to find a better solution for this by any chance?
Yury
Reply all
Reply to author
Forward
0 new messages