Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca6cd19

Browse filesBrowse files
committed
matplotlib.get_home: Removing catch-all except blocks.
1 parent 941efd4 commit ca6cd19
Copy full SHA for ca6cd19

File tree

Expand file treeCollapse file tree

1 file changed

+5
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-7
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -479,18 +479,16 @@ def _get_home():
479479
"""
480480
try:
481481
path = os.path.expanduser("~")
482-
except:
482+
except ImportError:
483+
# This happens on Google App Engine (pwd module is not present).
483484
pass
484485
else:
485486
if os.path.isdir(path):
486487
return path
487488
for evar in ('HOME', 'USERPROFILE', 'TMP'):
488-
try:
489-
path = os.environ[evar]
490-
if os.path.isdir(path):
491-
return path
492-
except:
493-
pass
489+
path = os.environ.get(evar)
490+
if path is not None and os.path.isdir(path):
491+
return path
494492
return None
495493

496494

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.