1

I have a setup.py script for a module. This setup.py script features conversion of a Markdown README file to reStructuredText (suitable for PyPI). When an attempt is made to install this module using pip (sudo pip install supermodule), the following error is presented:

Collecting supermodule
  Downloading supermodule-2017.1.12.2329.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-build-GijMOu/supermodule/setup.py", line 43, in <module>
        main()
      File "/tmp/pip-build-GijMOu/supermodule/setup.py", line 14, in main
        long_description = pypandoc.convert("README.md", "rst"),
      File "/usr/local/lib/python2.7/dist-packages/pypandoc/__init__.py", line 50, in convert
        outputfile=outputfile, filters=filters)
      File "/usr/local/lib/python2.7/dist-packages/pypandoc/__init__.py", line 68, in _convert
        raise RuntimeError('Missing format!')
    RuntimeError: Missing format!

What is going wrong and how can I fix this?

The setup.py script is as follows:

#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import pypandoc
import setuptools

def main():

    setuptools.setup(
        name             = "supermodule",
        version          = "2017.01.12.2329",
        description      = "super module",
        long_description = pypandoc.convert("README.md", "rst"),
        url              = "https://github.com/user/supermodule",
        author           = "A. Person",
        author_email     = "ap@sern.ch",
        license          = "GPLv3",
        py_modules       = [
                           "supermodule"
                           ],
        install_requires = [
                           "opencv",
                           "docopt",
                           "propyte",
                           "shijian",
                           "tonescale"
                           ],
        scripts          = [
                           "supermodule_test.py"
                           ],
        entry_points     = """
            [console_scripts]
            supermodule = supermodule:supermodule
        """
    )

def read(*paths):
    with open(os.path.join(*paths), "r") as filename:
        return filename.read()

if __name__ == "__main__":
    main()
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
d3pd
  • 7,935
  • 24
  • 76
  • 127
  • 1
    Just to be sure, do you actually have `pandoc` installed on the computer you are running `pip`? – Sergio Correia Jan 13 '17 at 05:10
  • 1
    what actually is on `setup.py, line 43` ? – mb21 Jan 13 '17 at 09:17
  • @SergioCorreia Yes, both Pandoc and pypandoc are installed. As far as I can see, the error is arising from the use of `pypandoc.convert("README.md", "rst")`. The error is displayed if the file `README.md` is not visible to pypandoc (and that means that the error is confusing), but I am not sure why the file would not be visible in the first place. – d3pd Jan 13 '17 at 12:29
  • @mb21 Sorry, I forgot to add the `setup.py` file. I've added it now. I think the point at which the error starts is `pypandoc.convert("README.md", "rst")` and it may be because `pypandoc` isn't seeing the `README.md` file (and also is producing a confusing error). – d3pd Jan 13 '17 at 12:31
  • That error is certainly confusing, but I'm guessing you only want to convert to rst when you are building the package to PyPI? (users don't need the rst file). In that case, what if you wrap the code in a `try... except` clause, as here: https://github.com/sergiocorreia/panflute/blob/master/setup.py#L15 – Sergio Correia Jan 13 '17 at 23:18
  • if you've got an older pypandoc version, the error is probably bogus... see https://github.com/bebraw/pypandoc/issues/86 (so I think you're right that the problem is that it cannot find the README.md file..) – mb21 Jan 14 '17 at 12:36

0 Answers0