From 53e0d8b606a2099cc5aac69a5b5eb32963eded5b 2013-07-23 05:04:00 From: Paul Ivanov Date: 2013-07-23 05:04:00 Subject: [PATCH] Merge pull request #3733 from ivanov/pandoc-missing Nicer message when pandoc is missing, closes #3730 --- diff --git a/IPython/nbconvert/utils/pandoc.py b/IPython/nbconvert/utils/pandoc.py index 3823d80..299b648 100644 --- a/IPython/nbconvert/utils/pandoc.py +++ b/IPython/nbconvert/utils/pandoc.py @@ -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]