pytest-plugins icon indicating copy to clipboard operation
pytest-plugins copied to clipboard

Small issue with pypandoc and common_setup (hit while installing pytest-profiling)

Open beaugunderson opened this issue 7 years ago • 4 comments

If the pypandoc module is installed but pandoc is not then import pypandoc will succeed but the pypandoc module will not have a convert attribute when imported, leading to an AttributeError being raised, which common_setup does not currently catch.

The workaround for us is to install pandoc before doing our pip installs so that the convert attribute exists when it needs to.

It would be nice if common_setup could catch the AttributeError, so that the installation order wouldn't matter.

beaugunderson avatar Jul 01 '18 18:07 beaugunderson

Hmm... I reversed the installation order (pandoc before pypandoc and pytest-profiling) and the error persists:

Collecting pytest-profiling==1.3.0 (from -r requirements.txt (line 136))
  Downloading https://files.pythonhosted.org/packages/f5/34/4626126e041a51ef50a80d0619519b18d20aef249aac25b0d0fdd47e57ee/pytest-profiling-1.3.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-xhgcq3du/pytest-profiling/setup.py", line 40, in <module>
        kwargs = common_setup('pytest_profiling')
      File "/tmp/pip-install-xhgcq3du/pytest-profiling/common_setup.py", line 54, in common_setup
        long_description = pypandoc.convert(readme_file, 'rst')
    AttributeError: module 'pypandoc' has no attribute 'convert'

beaugunderson avatar Jul 01 '18 18:07 beaugunderson

It also appears that the availability of convert does not depend on pandoc being installed; I was mistaken about that. I don't currently see a way for this error to happen, though since the README doesn't matter for those just wanting to install the module I think the AttributeError should be caught.

beaugunderson avatar Jul 01 '18 18:07 beaugunderson

We have the similar isssue https://github.com/autowarefoundation/autoware/discussions/286. I created PR for the issue by #205

shmpwk avatar May 11 '22 02:05 shmpwk

Hi there.

I'm the maintainer of PyPandoc, which seems to be the root error in ops post.

In the recent release of PyPandoc (version 1.8), the convert function was removed after a year of being deprecated.

The solution here, is to either switch to pypandoc.convert_file or pypandoc.convert_text, depending

JessicaTegner avatar May 11 '22 14:05 JessicaTegner