Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit15d09a5

Browse files
committed
Work around subprocess.CalledProcessError on Google App Engine
Set subprocess.CalledProcessError to None on restrictive environmentslike Google App Engine because the exception cannot be raised and thereis no need to catch it.Fixes#1825 which broke after#1857.
1 parent8863ace commit15d09a5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎lib/matplotlib/compat/subprocess.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,25 @@
1818

1919
importsubprocess
2020

21-
__all__= ['Popen','PIPE','STDOUT','check_output']
21+
__all__= ['Popen','PIPE','STDOUT','check_output','CalledProcessError']
2222

2323

2424
ifhasattr(subprocess,'Popen'):
2525
Popen=subprocess.Popen
2626
# Assume that it also has the other constants.
2727
PIPE=subprocess.PIPE
2828
STDOUT=subprocess.STDOUT
29+
CalledProcessError=subprocess.CalledProcessError
2930
else:
3031
# In restricted environments (such as Google App Engine), these are
3132
# non-existent. Replace them with dummy versions that always raise OSError.
3233
defPopen(*args,**kwargs):
3334
raiseOSError("subprocess.Popen is not supported")
3435
PIPE=-1
3536
STDOUT=-2
37+
# There is no need to catch CalledProcessError. These stubs cannot raise
38+
# it. None in an except clause will simply not match any exceptions.
39+
CalledProcessError=None
3640

3741

3842
def_check_output(*popenargs,**kwargs):
@@ -75,5 +79,3 @@ def _check_output(*popenargs, **kwargs):
7579
check_output=subprocess.check_output
7680
else:
7781
check_output=_check_output
78-
79-
CalledProcessError=subprocess.CalledProcessError

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp