[EMAIL PROTECTED] schrieb:
Hello all
I want to convert a tex file into a pdf by using pdflatex. For that, I thought
the 'subprocess' module might be a good option. My code doesn't work at all tho:
Import os, subprocess
def main():
scriptpath = os.path.dirname(__file__)
p = subprocess.Popen("pdflatex --include-directory=%s
--output-directory=%s/output --aux-directory=%s/temp --interaction=nonstopmode
myFile.tex"
% (scriptpath, scriptpath, scriptpath),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
cwd=scriptpath)
(child_stdin,
child_stdout,
child_stderr) = (p.stdin, p.stdout, p.stderr)
print 'stdin'
print child_stdin
print 'stdout'
print child_stdout
print 'stderr'
print child_stderr
When I run that code I get the following printouts:
stdin
<open file '<fdopen>', mode 'wb' at 0x009E7968>
stdout
<open file '<fdopen>', mode 'rb' at 0x009E7A40>
stderr
<open file '<fdopen>', mode 'rb' at 0x009E79F8>
Done
Just a guess - but how about consuming the very verbose latex ouptut?
Otherwise latex will stop when the stdout-pipe is full.
And beware of the interactive prompte of latex - that thing has bitten
me more than once.
Diez
--
http://mail.python.org/mailman/listinfo/python-list