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

Skip to content

allow selecting the backend by setting the environment variable MPLBACKEND #3710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 18, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
allow selecting the backend by setting the environment variable MPL_B…
…ACKEND
  • Loading branch information
FlorianRhiem committed Nov 17, 2014
commit 0d995d45ea5e48fc8e3aa60e577db006871895bf
9 changes: 9 additions & 0 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1373,9 +1373,18 @@ def tk_window_focus():
if s.startswith(str('-d')) and len(s) > 2: # look for a -d flag
try:
use(s[2:])
break
except (KeyError, ValueError):
pass
# we don't want to assume all -d flags are backends, e.g., -debug
else:
# no backend selected from the command line, so we check the environment
# variable MPL_BACKEND
if 'MPL_BACKEND' in os.environ:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this line is superfluous, since you are catching KeyError.

try:
use(os.environ['MPL_BACKEND'])
except (KeyError, ValueError):
pass

default_test_modules = [
'matplotlib.tests.test_agg',
Expand Down