Skip to content

Commit 9eb8187

Browse files
committed
Merge pull request JessicaTegner#7 from benjaoming/patch-1
Gracefully fail when pandoc is missing
2 parents 2548a7a + 0a5c18f commit 9eb8187

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎pypandoc.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,14 @@ def get_pandoc_formats():
6868
Dynamic preprocessor for Pandoc formats.
6969
Return 2 lists. "from_formats" and "to_formats".
7070
'''
71-
p = subprocess.Popen(
72-
['pandoc', '-h'],
73-
stdin=subprocess.PIPE,
74-
stdout=subprocess.PIPE)
71+
try:
72+
p = subprocess.Popen(
73+
['pandoc', '-h'],
74+
stdin=subprocess.PIPE,
75+
stdout=subprocess.PIPE)
76+
except OSError:
77+
raise OSError("You probably do not have pandoc installed.")
78+
7579
help_text = p.communicate()[0].decode().splitlines(False)
7680
txt = ' '.join(help_text[1:help_text.index('Options:')])
7781

0 commit comments

Comments
 (0)