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

Skip to content

Commit 9643a57

Browse files
committed
Treat empty $MPLBACKEND as an unset value.
This allows one to temporarily unset the environment variable with `MPLBACKEND= python ...`, and is consistent with standard behavior.
1 parent 3a5d8c2 commit 9643a57

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,10 +1365,8 @@ def use(arg, warn=True, force=False):
13651365
importlib.reload(sys.modules['matplotlib.backends'])
13661366

13671367

1368-
try:
1368+
if os.environ.get('MPLBACKEND'):
13691369
use(os.environ['MPLBACKEND'])
1370-
except KeyError:
1371-
pass
13721370

13731371

13741372
def get_backend():

0 commit comments

Comments
 (0)