# “pdflatex: Not writing to” error when using python [closed]

I use python3 (with code not from me) to insert data from a database (bsddb3) into a LaTeX document and I receive the following error messages:

pdflatex: Not writing to .aux (openout_any = p).
! I can't write on file .aux'.


The same happens with the .out, .toc, and .lof files. I understand the meaning of the message and that it is a precaution but I do not know why it would appear now while using the code. It never did by using pdflatex via CLI in other projects.

Shall I set an output directory when calling pdflatex via -output-directory=DIR or what would help here (without opening a security hole!)?

Edit

Second part of the error message:

\document ...ate \openout \@mainaux \jobname .aux
\immediate \write \@mainau...
l.22         \begin{document}


Line 22 does not help me to find the mistake in the python code at this point because the latex input is written into the python code.

## closed as unclear what you're asking by egreg, user13907, Jesse, Mico, WernerJun 10 '15 at 16:26

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• is your command line something like pdflatex ../foo/file.tex if so it will fail to write ../foo/file.aux so you need cd ../foo; pdflatex file.tex – David Carlisle May 11 '15 at 10:05
• Oh no, I misread, it literally means .aux that is you have managed to call latex with an empty filename what commandline did you use?? – David Carlisle May 11 '15 at 10:07
• Ah, my error message I posted was not complete. See edit. – Til Hund May 11 '15 at 11:13
• yes but that seems to imply that \jobname is empty, which is quite hard to acheive (tex uses the name texput` if it is reading from stdin and doesn't have a real filename) – David Carlisle May 11 '15 at 11:38
• I fixed my problem. The name of the output file was empty and accepted like this by the python program. – Til Hund May 11 '15 at 12:13