This site will be undergoing dramatic maintenance, mostly because I hate php and don't want to continue to support the hybrid php/python implementation I have running, so be forewarned that the site (which has extremely low traffic since I'm not allowed to post anything fun anymore) may be down from time to time over the next week or two. (Sep 15, 2013)

mayor
 

import awesomeness as awsm

 

awsm.get_fortune('random')

Your mode of life will be changed to EBCDIC.

 

awsm.get_post_content('Redirect Maya’s output To stdout')

Posted at: September 20th, 2011 by: John Neumann

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!

Posted in Knowledge, Linux Scripts, Maya, Scripts, Tips and Tricks | You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

5 Responses to “Redirect Maya’s output To stdout”

  1. Putting it in the userSetup.py causes maya to crash.
    Nice tip though.

  2. cgbeige says:

    wow – cool. thanks

  3. John Neumann says:

    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!

  4. Derek McAtavey says:

    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.

  5. Rahul says:

    Gerard Try this

    MAYA_CMD_FILE_OUTPUT = c:\MayaScriptEditorOutput.txt

Leave a Reply

:p 8) :lol: =( :8 ;) :(( :o: :[ :) :D :-| :-[) :bloody: :cool: :choler: :love: :oups: :aie: :beurk:

*

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