[portland] A Question of Directories

Adam Lowry adam at therobots.org
Tue Apr 8 22:34:37 CEST 2008


Rich Shepard wrote:
>    But, when I issue the command
> os.system('pdflatex ./reports/omrPairs.tex')
> 
> the resulting .aux, .log, and .pdf files are in the parent directory, not
> the reports/ subdirectory.
> 

I don't have pdflatex handy, but I imagine it defaults to dumping output into
the current working directory. There might be a command line option, but if
not you can either:

import os
os.chdir('tmp')
os.system('pdflatex ./reports/omrPairs.tex')

Or use the subprocess module instead of os.system, which has a working
directory option:

import subprocess
subprocess.call(['pdflatex', './reports/omrPairs.tex'], cwd='reports')

Adam


More information about the Portland mailing list