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

Skip to content

Commit a7d9266

Browse files
committed
Merge pull request #2860 from daradib/subprocess-google-app-engine
Fix subprocess.CalledProcessError on Google App Engine
2 parents 8863ace + 15d09a5 commit a7d9266

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
import subprocess
2020

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

2323

2424
if hasattr(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
def Popen(*args, **kwargs):
3334
raise OSError("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)