I'm creating a pdf-latex file with a python script such as it is explained in Generating pdf-latex with python script and it works perfectly.
However, I would like to generate a table of contents for my file. The problem is that, using a latex generator as TexWorks for example, you need to compile it twice (in first compiling you generate the .pdf file without toc and .out and .toc files with toc's information, while in second compiling toc's information is added to the pdf.file), but it doesn't work if you run the script twice.
Thanks you in advance.