If there is no Jupyter or IPython installed, it should show
False
Actual Results
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "<path to conda environment>/lib/site-packages/dcase_util/utils/utils.py", line 191, in is_jupyter
from IPython import get_ipython
ModuleNotFoundError: No module named 'IPython'
It tried from IPython import get_ipython, if get_ipython dose not exist, it will catch a NameError and return False.
However, this actually assumes that there is IPython. If IPython or Jupyter is not installed, an ModuleNotFoundError will be raised and cannot be correctly caught.
Description
NoModuleFoundError
raised when usingdcase_util.utils.is_jupyter()
and other functions calling it.Steps/Code to Reproduce
Expected Results
If there is no Jupyter or IPython installed, it should show
Actual Results
Versions
Note: no
IPython
module installed in this environment.Cause
It tried
from IPython import get_ipython
, ifget_ipython
dose not exist, it will catch aNameError
andreturn False
.However, this actually assumes that there is
IPython
. If IPython or Jupyter is not installed, anModuleNotFoundError
will be raised and cannot be correctly caught.Possible Fix
Change line https://github.com/DCASE-REPO/dcase_util/blob/master/dcase_util/utils/utils.py#L208 to be