Trouble with os.system

Charles-Pierre Astolfi cp.astolfi at gmail.com
Wed Feb 3 14:15:56 EST 2010


That was it ! What a stupid error...

Thank you !
-- 
Cp



On Wed, Feb 3, 2010 at 20:13, Jerry Hill <malaclypse2 at gmail.com> wrote:
> On Wed, Feb 3, 2010 at 12:58 PM, Cpa <cp.astolfi at gmail.com> wrote:
>> 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.
>
> I think your bug is in the lines you chose not to share with us.  I
> bet you've forgotten to close the last file you create, so that file
> has changes that haven't been flushed out to the disk yet.  Make sure
> you call close() on each of the files when you're done writing them.
>
> --
> Jerry
>



More information about the Python-list mailing list