Raising exception on STDIN read
Grant Edwards
grante at visi.com
Wed Feb 27 16:34:27 EST 2008
On 2008-02-27, Michael Goerz <newsgroup898sfie at 8439.e4ward.com> wrote:
> Hi,
>
> I would like to raise an exception any time a subprocess tries to read
> from STDIN:
>
> latexprocess = subprocess.Popen( \
> 'pdflatex' + " " \
> + 'test' + " 2>&1", \
> shell=True, \
> cwd=os.getcwd(), \
> env=os.environ, \
> stdin=StdinCatcher() # any ideas here?
> )
>
> An exception should be raised whenever the pdflatex process
> reads from STDIN... and I have no idea how to do it. Any suggestions?
If I were you, I'd just run LaTeX in batch mode. That's what I
always used to do when automating the running of LaTeX using a
shell script or makefile. IIRC, you do something like this:
ret = os.system("latex \\batchmode\\input %s" % filename)
The return status will be zero for success and non-zero if
there were any errors.
--
Grant Edwards grante Yow! Remember, in 2039,
at MOUSSE & PASTA will
visi.com be available ONLY by
prescription!!
More information about the Python-list
mailing list