Skip to content

Commit

Permalink
pkg_resources is an optional dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Sep 2, 2019
1 parent 35576d5 commit 745863d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jupytext/pandoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import tempfile
# Copy nbformat reads and writes to avoid them being patched in the contents manager!!
from nbformat import reads as ipynb_reads, writes as ipynb_writes
from pkg_resources import parse_version


class PandocError(OSError):
Expand Down Expand Up @@ -44,6 +43,12 @@ def is_pandoc_available():
def pandoc_version():
"""Pandoc's version number"""
version = pandoc(u'--version').splitlines()[0].split()[1]

try:
from pkg_resources import parse_version
except ImportError:
raise PandocError('Please install pkg_resources')

if parse_version(version) < parse_version('2.7.2'):
raise PandocError('Please install pandoc>=2.7.2 (found version {})'.format(version))

Expand Down

0 comments on commit 745863d

Please sign in to comment.