JessicaTegner/pypandoc

Tests failed with pandoc built without embed_data_files

felixonmars opened this issue · 2 comments

According to jgm/pandoc#5045 pandoc built without embed_data_files won't be able to read its data file with sandbox enabled.

The option embed_data_files is defaulting to false: https://github.com/jgm/pandoc/blob/697aea371717f3dab5484227fcd8025bbd45c70b/pandoc.cabal#L415

This results in the following test failures:

======================================================================
ERROR: test_conversion_from_non_plain_text_file (tests.TestPypandoc)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-pypandoc/src/pypandoc-1.7.4/tests.py", line 406, in test_conversion_from_non_plain_text_file
    received = pypandoc.convert_text('# some title\n', to='docx', format='md', outputfile=file_name)
  File "/build/python-pypandoc/src/pypandoc-1.7.4/pypandoc/__init__.py", line 113, in convert_text
    return _convert_input(source, format, 'string', to, extra_args=extra_args,
  File "/build/python-pypandoc/src/pypandoc-1.7.4/pypandoc/__init__.py", line 372, in _convert_input
    raise RuntimeError(
RuntimeError: Pandoc died with exitcode "97" during conversion: Could not find data file data/data/docx/[Content_Types].xml


======================================================================
ERROR: test_conversion_stderr (tests.TestPypandoc)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-pypandoc/src/pypandoc-1.7.4/tests.py", line 327, in test_conversion_stderr
    with capture(pypandoc.convert_text,
  File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/build/python-pypandoc/src/pypandoc-1.7.4/tests.py", line 24, in capture
    command(*args, **kwargs)
  File "/build/python-pypandoc/src/pypandoc-1.7.4/pypandoc/__init__.py", line 113, in convert_text
    return _convert_input(source, format, 'string', to, extra_args=extra_args,
  File "/build/python-pypandoc/src/pypandoc-1.7.4/pypandoc/__init__.py", line 372, in _convert_input
    raise RuntimeError(
RuntimeError: Pandoc died with exitcode "97" during conversion: Could not find data file data/data/docx/[Content_Types].xml


======================================================================
ERROR: test_conversion_stderr_nullhandler (tests.TestPypandoc)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-pypandoc/src/pypandoc-1.7.4/tests.py", line 353, in test_conversion_stderr_nullhandler
    with capture(pypandoc.convert_text,
  File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/build/python-pypandoc/src/pypandoc-1.7.4/tests.py", line 24, in capture
    command(*args, **kwargs)
  File "/build/python-pypandoc/src/pypandoc-1.7.4/pypandoc/__init__.py", line 113, in convert_text
    return _convert_input(source, format, 'string', to, extra_args=extra_args,
  File "/build/python-pypandoc/src/pypandoc-1.7.4/pypandoc/__init__.py", line 372, in _convert_input
    raise RuntimeError(
RuntimeError: Pandoc died with exitcode "97" during conversion: Could not find data file data/data/docx/[Content_Types].xml


----------------------------------------------------------------------
Ran 29 tests in 88.465s

FAILED (errors=3)

interesting. Was this introduced recently, cause as you can see, all tests seems to be passing on the CI?

I guess the binary pypandoc downloads has the flag on to ease the usage. Unfortunately it's often not enabled in a distribution packaged pandoc.