Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 681bfd0

Browse files
committed
Merge pull request #4939 from jenshnielsen/jupyter4import
MNT: fix Jupyter shim warning
2 parents 37f7df6 + fee873c commit 681bfd0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/backends/backend_nbagg.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
import tornado.ioloop
1515

1616
from IPython.display import display, Javascript, HTML
17-
from IPython.kernel.comm import Comm
17+
try:
18+
# Jupyter/IPython 4.x or later
19+
from ipykernel.comm import Comm
20+
except ImportError:
21+
# Jupyter/IPython 3.x or earlier
22+
from IPython.kernel.comm import Comm
1823

1924
from matplotlib import rcParams
2025
from matplotlib.figure import Figure

0 commit comments

Comments
 (0)