Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pandoc issue #986

Open
esskidri opened this issue Jul 5, 2022 · 0 comments
Open

pandoc issue #986

esskidri opened this issue Jul 5, 2022 · 0 comments

Comments

@esskidri
Copy link

esskidri commented Jul 5, 2022

Hi all,

I have a question regarding the setup.py code. In particular about the following function:

def read_to_rst(fname):
    try:
        import pypandoc
        rstname = "{}.{}".format(os.path.splitext(fname)[0], 'rst')
        pypandoc.convert(read(fname), 'rst', format='md', outputfile=rstname)
        with open(rstname, 'r') as f:
            rststr = f.read()
        return rststr
        #return read(rstname)
    except ImportError:
        return read(fname)

Instead of catching only the import error, is it not better to use a more generic exception?
There are more many cases in which pypandoc can fail, for example if pandoc is not installed, or in the case pandoc is not reachable from pypandoc, even if pandoc is installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant