The mel module doesn't provide a 'print' statement... only an eval.  To do
what you'd want, you'd have to do something like this:

import maya.mel as mel
mel.eval("print foo")

- Paul

On Thu, Jan 7, 2010 at 12:39 AM, efecto <[email protected]> wrote:

> Thank you Paul. so importing maya.mel and use mel's print command
> doesn't do any good..?
>
> I tried
> import maya.mel as mel
> mel.print("test..\n")
> but this gives an error.
>
> Thanks.
>
> On Jan 7, 8:57 pm, Paul Molodowitch <[email protected]> wrote:
> > Python's print does show up in the command output... the problem is, it
> also
> > "shows" newline statements... and since every normal print statement
> > automatically adds a newline, and the output only shows a single line -
> you
> > end up seeing nothing.
> >
> > To see the results of a print statement down there, you have to use the
> > print statement with a final comma:
> >
> > print "This will show up!",
> >
> > ...the problem then becomes that whatever you print next will need to
> start
> > with a newline, or else look ugly.  And, of course, anything not printed
> > directly by you will have no such newline.
> >
> > One way around this - when you explicitly want to show something down
> there
> > - is to use MGlobal's display* methods:
> >
> > from maya.OpenMaya import MGlobal
> >
> > MGlobal.displayInfo("Standard Info")
> > MGlobal.displayWarning("Danger, Will Robinson!")
> > MGlobal.displayError("...and the runner advances to 2nd base.")
> >
> > You also get the added advantage of fancy coloring for Warnings and
> > Errors...
> >
> > - Paul
>
> --
> http://groups.google.com/group/python_inside_maya
>
-- 
http://groups.google.com/group/python_inside_maya

Reply via email to