Skip to content

Commit 11fb6a9

Browse files
committed
Fix two_seven_compatible function to use specific exception.
1 parent 8f4333b commit 11fb6a9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

wes_client/util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import json
33
import schema_salad.ref_resolver
4-
import subprocess
4+
from subprocess32 import check_call, DEVNULL, CalledProcessError
55
import yaml
66
import glob
77
import requests
@@ -15,10 +15,10 @@
1515
def _two_seven_compatible(filePath):
1616
"""Determines if a python file is 2.7 compatible by seeing if it compiles in a subprocess"""
1717
try:
18-
passes = not subprocess.call(['python2', '-m', 'py_compile', filePath])
19-
except:
18+
check_call(['python2', '-m', 'py_compile', filePath],stderr=DEVNULL)
19+
except CalledProcessError:
2020
raise RuntimeError('Python files must be 2.7 compatible')
21-
return passes
21+
return True
2222

2323

2424
def _get_version(extension, workflow_file):

0 commit comments

Comments
 (0)