Skip to content

Commit

Permalink
Merge pull request ipython#3733 from ivanov/pandoc-missing
Browse files Browse the repository at this point in the history
Nicer message when pandoc is missing, closes ipython#3730
  • Loading branch information
ivanov committed Jul 23, 2013
2 parents 48992a2 + da32387 commit 719c7b5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions IPython/nbconvert/utils/pandoc.py
Expand Up @@ -47,9 +47,13 @@ def pandoc(source, fmt, to, extra_args=None, encoding='utf-8'):
command = ['pandoc', '-f', fmt, '-t', to]
if extra_args:
command.extend(extra_args)
p = subprocess.Popen(command,
stdin=subprocess.PIPE, stdout=subprocess.PIPE
)
try:
p = subprocess.Popen(command,
stdin=subprocess.PIPE, stdout=subprocess.PIPE
)
except OSError:
sys.exit("ERROR: Unable to launch pandoc. Please install pandoc:\n"
"(http://johnmacfarlane.net/pandoc/installing.html)")
out, _ = p.communicate(cast_bytes(source, encoding))
out = out.decode(encoding, 'replace')
return out[:-1]
Expand Down

0 comments on commit 719c7b5

Please sign in to comment.