pypandoc icon indicating copy to clipboard operation
pypandoc copied to clipboard

test_pdf_conversion fails on macos when pdflatex is missing

Open jayvdb opened this issue 3 years ago • 1 comments

When running on Python 3.9 , and without pdflatex installed (part of brew package mactex).

ERROR: test_pdf_conversion (__main__.TestPypandoc)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jayvdb/inv/pypandoc/tests.py", line 318, in test_pdf_conversion
    ret = pypandoc.convert_text('# some title\n', to='pdf', format='md', outputfile=file_name)
  File "/Users/jayvdb/inv/pypandoc/pypandoc/__init__.py", line 100, in convert_text
    return _convert_input(source, format, 'string', to, extra_args=extra_args,
  File "/Users/jayvdb/inv/pypandoc/pypandoc/__init__.py", line 335, in _convert_input
    raise RuntimeError(
RuntimeError: Pandoc died with exitcode "1" during conversion: pandoc: pdflatex: createProcess: posix_spawnp: illegal operation (Inappropriate ioctl for device)

This is a overly complicated exception message that many users wont recognise as "I need to install pdflatex". As it is possible to use alternative latex engines, it would be best to catch this error, detect "pdflatex" in the message, check for whether pdflatex is in the PATH, and provide a better exception message only if it is missing.

jayvdb avatar Nov 23 '21 01:11 jayvdb

yes I agree. In addition, I would guess that missing the other engines (if used) would also yield just as complicated an error message, so maybe we should do that for all the engines.

JessicaTegner avatar Nov 23 '21 07:11 JessicaTegner