Trouble with os.system

Cpa cp.astolfi at gmail.com
Wed Feb 3 18:58:43 CET 2010


Sure.

import sys,re,os
files2create = sys.argv[1:]
os.system('mkdir tmp')

# Some code to create the .tex

# Compile tex files
os.system('for file in tmp/*; do pdflatex "$file"; done')

Pretty simple, alas.

--
Cpa


On 3 fév, 18:54, Gerald Britton <gerald.brit... at gmail.com> wrote:
> Can you post your code?
>
>
>
> On Wed, Feb 3, 2010 at 12:47 PM, Cpa <cp.asto... at gmail.com> wrote:
> > Hi there,
>
> > I'm having some trouble with os.system on Fedora 12.
> > I have a bunch of .tex files in tmp/ and I want to compile them.
> > In my shell, the following commands work perfectly : 'for file in tmp/
> > *.tex; do pdflatex "$file"; done'.
>
> > But if I use the same command using os.system(), it will compile
> > correctly every file except the last one, for which it raises an error
> > (I get a prompt, as if I did a syntax error in tex document).
>
> > I suspected some kind of escaping issue, but it won't even work with
> > files such as : foo.txt, bar.txt.
>
> > Any idea ?
> > Thanks,
> > Cpa
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> --
> Gerald Britton




More information about the Python-list mailing list