python-3.xpandocpypandoc

Pypandoc error , RuntimeError: Pandoc died with exitcode "47" during conversion: b'pdflatex not found


First time posting here,by the way, i've got an issue with this particular line of Python (3.6) code:

file_converted = pandoc.convert_file(PATH_TO_ODT, 'pdf', format="odt", outputfile=file_name + ".pdf", extra_args=['--pdf-engine=pdflatex'])

When i execute the script (to convert a .odt file to a .pdf file) , i encounter the following error :

RuntimeError: Pandoc died with exitcode "47" during conversion: b'pdflatex not found. Please select a different --pdf-engine or install pdflatex

Basically i understand that i need "pdflatex" , but after i've installed it via pip with the command

pip install pdflatex, the execution produce the same error message, what i should do or check? thank you all.


Solution

  • For pypandoc, which simply calls the pandoc commandline program, which in turn calls pdflatex, you should probably install LaTeX system-wide. On Ubuntu, that is:

    sudo apt install texlive