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.
Ooops. Just did a quick test, and you need to double up the
backslashes one more time when using os.system(). I think
there might also be a way to supress the chatter coming out of
TeX, but if you're using subprocess, you can just attach stdout
and stderr to a bitbucket. Here's a demo where label1.tex has
no errors and label2.tex has an error:
________________________testit.py____________________________________
import os
ret1 = os.system('latex \\\\batchmode\\\\input %s' % 'label1.tex')
print ret1
ret2 = os.system('latex \\\\batchmode\\\\input %s' % 'label2.tex')
print ret2
_____________________________________________________________________
$ python testit.py
This is pdfeTeX, Version 3.141592-1.30.5-2.2 (Web2C 7.5.5)
entering extended mode
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, b
ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e
stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis
h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur
kish, ukrainian, nohyphenation, loaded.
0
This is pdfeTeX, Version 3.141592-1.30.5-2.2 (Web2C 7.5.5)
entering extended mode
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, b
ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e
stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis
h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur
kish, ukrainian, nohyphenation, loaded.
256