capturing stderr && stdout
Bjorn Pettersen
bjorn at roguewave.com
Tue Nov 2 15:59:16 EST 1999
What you want is in module popen2, probably popen2.popen3 (they're described
in the module reference).
-- bjorn
> -----Original Message-----
> From: Agent Drek [mailto:drek at monsterbymistake.com]
> Sent: Tuesday, November 02, 1999 12:19 PM
> To: python-list at python.org
> Subject: capturing stderr && stdout
>
>
> 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"
--
http://www.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list