maya2egg stdio >> log file

So, in my ongoing quest to make tools for our artists, I’ve come to the point where i’d like to call something like

C:/maya2egg [opts] -o output.egg input.mb 2>>errorlog.txt

from a batch script, so that in the event that 300 maya files are being converted to .egg during a giant rebuild process and we all go out for coffee in the interim, any errors will be logged to a file. Unfortunately, it looks like stdout is getting overloaded by something in maya2egg…i mean, all the << in the source for mayaToEggConverter lead me to believe that it is indeed going to the ostream, so how come something as simple as

maya2egg7 -v 2>&1>output.txt

doesn’t redirect anything?

Another thing i’ve noticed…if I try using maya2egg8 instead (which I don’t have installed, but have the app in panda/bin), it DOES redirect: “Cannot locate Maya 8.0 (registry key missing)” to the test.txt file.
I also noticed that in one of the usages for maya2egg, the maya file is redirected to the egg file in a similar way: maya.mb > panda.egg. Does this create a conflict in output?

Anyone ever been able to write a converter’s output to a file?

Thanks in advance :]

Order is important on the bash command line. Try:
maya2egg7 -v >output.txt 2>&1

Or just:
maya2egg7 -v 2>output.txt

Note that this is stderr you are redirecting (file 2), not stdout (file 1). In general, the error messages from Panda converter programs are written to stderr.


I should also point out that the syntax with “2>” etc. is a bash convention, not a Windows convention. If you are running on Windows, you have to be using a Cygwin bash script or bash shell, not a .bat file or the system Command window for this to work.

I don’t know if there is a similar convention to redirect stderr from the Windows command shell or within a .bat file.


Thanks David!