JessicaTegner / pypandoc

Thin wrapper for "pandoc" (MIT)
http://pypi.python.org/pypi/pypandoc/
Other
875 stars 111 forks source link

Warnings of "data file translations/en.yaml not found" although file exists #354

Open novoid opened 9 months ago

novoid commented 9 months ago

Hi,

I've got a Debian stable host running pandoc 2.17.1.1, pypandoc 1.10, Python 3.11.2 and I do have an issue when running https://github.com/novoid/lazyblorg/ in a virtualenv in case that this matters.

The issue consists of many warning messages, "polluting" the output console with those snippets:

WARNING:pypandoc:Could not load translations for en-US
  data file translations/en.yaml not found
WARNING:pypandoc:The term Abstract has no translation defined.

One for each pypandoc call, which it uses often.

I already "disabled" logging messages via logging.getLogger('pypandoc').addHandler(logging.NullHandler()) as described in the README. This removed some other output but not the one above.

I tried to symlink the translations dir according to hints from https://github.com/jgm/pandoc/issues/6885

mkdir ~/.pandoc/     
cd ~/.pandoc/
ln -s /usr/share/pandoc/data/translations .
ls ~/.pandoc/translations/en.yaml   ## shows correct file

That didn't help.

I could not identify any relevant PATH parameter in convert_text() from https://github.com/JessicaTegner/pypandoc/blob/master/pypandoc/__init__.py which would allow me to set the data/translations path.

Furthermore, I did not find any pandoc option I would have been able to use with the extra_args of convert_text().

Somehow, (py)pandoc is not able to locate the existing translation file /usr/share/pandoc/data/translations/en.yaml.

Not that this file is needed in my case but I think it would solve my issue when (py)pandoc would be able to access that file.

Any idea what I could do to fix this?

JessicaTegner commented 8 months ago

Hmm. Interesting one.

The log output you provided, suggest that it's "pandoc" that can't find the translation file, however I have never seen this before.

I know running pypandoc in a venv shouldn't effect this. My only suggestions would be to either try to set the data dir argument when using convert_*, check the pandoc documentation, or asking JGM about it as this seems more like a pandoc issue more than a (py)pandoc issue

novoid commented 8 months ago

I may not be that familiar with calling pandoc in the shell. What would be a command line to reproduce the issue without the whole Python layer?

Simple "pandoc input.org -o output.pdf" calls are working without that warning message, for example.

danielkauffman commented 6 months ago

Identical issue, likewise on Debian stable running pandoc 2.17.1.1, pypandoc 1.7.4, and python 3.11.2.

Resolved (for my purposes) by upgrading pandoc and pypandoc from Debian testing to pandoc 3.1.3, pypandoc 1.12.