mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-05 21:02:36 +01: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:
@@ -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
|
||||
|
Reference in New Issue
Block a user