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

Skip to content

Commit 1dbdd8c

Browse files
authored
Merge pull request #12224 from meeseeksmachine/auto-backport-of-pr-12207-on-v3.0.x
Backport PR #12207 on branch v3.0.x (FIX: dont' check for interactive framework if none required)
2 parents 75ec309 + 12f5dbb commit 1dbdd8c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/matplotlib/pyplot.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,15 @@ def switch_backend(newbackend):
211211
newbackend, Backend.backend_version)
212212

213213
required_framework = Backend.required_interactive_framework
214-
current_framework = \
215-
matplotlib.backends._get_running_interactive_framework()
216-
if (current_framework and required_framework
217-
and current_framework != required_framework):
218-
raise ImportError(
219-
"Cannot load backend {!r} which requires the {!r} interactive "
220-
"framework, as {!r} is currently running".format(
221-
newbackend, required_framework, current_framework))
214+
if required_framework is not None:
215+
current_framework = \
216+
matplotlib.backends._get_running_interactive_framework()
217+
if (current_framework and required_framework
218+
and current_framework != required_framework):
219+
raise ImportError(
220+
"Cannot load backend {!r} which requires the {!r} interactive "
221+
"framework, as {!r} is currently running".format(
222+
newbackend, required_framework, current_framework))
222223

223224
rcParams['backend'] = rcParamsDefault['backend'] = newbackend
224225

0 commit comments

Comments
 (0)