1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-21 20:38:57 +00:00

utils/ipython: handle nbconvert import

nbconvert has been split into a separate package and is installed as a
dependency for Jupyter rather than IPython. Add a proper import guard
to prevent issues for those that don't need ipython_converter
functionality, and set the appropriate error message for those that do.
This commit is contained in:
Sergei Trofimov 2017-09-14 08:29:44 +01:00
parent d8a5d2fa37
commit b312bf317d

View File

@ -37,6 +37,7 @@ NBFORMAT_VERSION = 3
if IPython:
if LooseVersion('6.0.0') > LooseVersion(IPython.__version__) >= LooseVersion('4.0.0'):
try:
import nbformat
from jupyter_client.manager import KernelManager
@ -50,6 +51,8 @@ if IPython:
IPYTHON_NBCONVERT_HTML = ['jupyter', 'nbconvert', '--to html']
IPYTHON_NBCONVERT_PDF = ['jupyter', 'nbconvert', '--to pdf']
except ImportError:
import_error_str = 'Please install "jupyter" as well as "ipython" packages.'
elif LooseVersion('4.0.0') > LooseVersion(IPython.__version__) >= LooseVersion('3.0.0'):
from IPython.kernel import KernelManager