Redirect Maya’s output To stdout

This is gonna be a quick post to get this information out there, however, I wanted to let all of you know I’m not dead (if you follow me on Twitter or G+ you know that though). I’ve just been busy at my new job at Reel FX as a Tools TD and I’ve got some awesome stuff in the pipe on here that should be coming out in the next few weeks. Hopefully a redesign of the site will come about as well, but I wouldn’t hold my breath for that. :) With that said, here we go.

So about a week ago I asked if anyone knew how to redirect Maya’s script editor output to the shell – because I was having some scenes crash on me and wanted to pin down exactly which line in the .ma file was doing it. There indeed is a way and it’s ridiculously stupidly easy. It should work if you’re launching it from the CLI (please note that I have no idea if this’ll work on anything other than Linux since that’s what we use here).

cmds.scriptEditorInfo(wh=True, hfn='/dev/stderr')

If you’re on windows you’ll need to change the hfn to something your system will understand – what that is I have no idea, maybe c:\bluescreenofdeath\error.log ;) Big thanks to Hesher (Derek McAtavey) for having the info on hand for me (albeit a week later than I’d needed it – in all fairness I hadn’t asked him, but he is on Twitter… I think).

So that’s that. Really simple. Hope this helps someone else out!

Published by

John Neumann

Stuff and things

5 thoughts on “Redirect Maya’s output To stdout”

  1. Hmmm… I’m guessing that’s because userSetup.py gets called before UI creation, so since there’s “nothing” to attach it to, it errors out. I’d try it myself, but our userSetup.py doesn’t even get loaded in because it’s setup through our network. :( I wonder if it was added to a scriptJob that loaded when a new scene was loaded if it would do it then. Since it’s only being called upon new scene creation it wouldn’t impact speed. Thanks for the info though!

  2. You should be able to wrap it in a cmds.evalDefered() call in a userSetup.py. That way it waits until after all the UI creation, when the call stack is empty, to re-direct.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.