capturing stderr && stdout
Agent Drek
drek at MonsterByMistake.Com
Tue Nov 2 14:18:47 EST 1999
Hullo,
I have searched the web and all the python documents/examples I could find
before posting here. My apologies if I have missed the obvious :) (I bought
two books as well that I am going through)
Alot of what I need to do with python depends on launching and controlling
a subprogram called hscript. It's a 'closed' application that is not a full
bodied language like python. I am hoping to launch one instance of hscript
write to it and keep its stdout && stderr.
Most of our work gets done with csh scripts like the following:
<csh_script>
#!/bin/csh -f
#csh stuff goes here
hscript -q $HIPDIR/$HIPFILE << ENDCAT >>&! $LOG
# now I write hscript commands
opcf /obj
#etc
ENDCAT
exit
</csh_script>
here's a stripped down version of what I have thus far.
<python_script>
#!/usr/local/bin/python
import os, sys
HSCRIPT = "hscript"
p = os.popen("%s" % HSCRIPT, "w")
p.write("opcd /obj\n")
p.write("opadd geo\n")
p.write("opls\n")
p.write("quit\n")
</python_script>
This is great so far but I just need stderr from hscript (just in case it
crashes:) and stdout (to keep a neat log file)
This will need to work on *nix.
I'm trying to move to python as our main scripting language so that we can
reuse code and integrate a gui (tkinter) easily into our apps.
If you're interested in what hscript is you can visit http://www.sidefx.com/
and check out houdini.
thanks for any tips,
=derek
Monster By Mistake Inc > 'digital plumber'
mailto:drek at monsterbymistake.com
http://www.interlog.com/~drek
"This mail was powered by Linux & Vim"
More information about the Python-list
mailing list