Changeset 25100


Ignore:
Timestamp:
06/22/20 11:39:17 (5 years ago)
Author:
jdquinn
Message:

BUG: Bad name for subprocess args.

Location:
issm/trunk-jpl/src/m
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/coordsystems/epsg2proj.py

    r25050 r25100  
    1515
    1616    TODO:
    17     - Implement try/catch for proc.communicate()
     17    - Implement try/catch for subproc.communicate()
    1818        - In case of Python 2, except socket.timeout: https://docs.python.org/3/library/socket.html?highlight=socket%20timeout#socket.timeout
    1919        - In case of Python 3, except TimeoutExpired: https://docs.python.org/3/library/subprocess.html#subprocess.SubprocessError
     
    2121
    2222    #First, get GDAL version
    23     args = "gdalsrsinfo --version | awk '{print $2}' | cut -d '.' -f1"
    24     proc = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    25     outs, errs = proc.communicate()
     23    subproc_args = "gdalsrsinfo --version | awk '{print $2}' | cut -d '.' -f1"
     24    subproc = subprocess.Popen(subproc_args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     25    outs, errs = subproc.communicate()
    2626    if errs != '':
    2727        raise RuntimeError("epsg2proj: call to gdalsrsinfo failed: {}".format(errs))
     
    2929    version_major=int(outs)
    3030
    31 args = "gdalsrsinfo epsg:{} | grep PROJ.4 | tr -d '\n' | sed 's/PROJ.4 : //'".format(epsg)
    32 proc = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    33 outs, errs = proc.communicate()
    34 if errs != '':
    35     raise RuntimeError("epsg2proj: call to gdalsrsinfo failed: {}".format(errs))
     31    subproc_args = "gdalsrsinfo epsg:{} | grep PROJ.4 | tr -d '\n' | sed 's/PROJ.4 : //'".format(epsg)
     32    subproc = subprocess.Popen(subproc_args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     33    outs, errs = subproc.communicate()
     34    if errs != '':
     35        raise RuntimeError("epsg2proj: call to gdalsrsinfo failed: {}".format(errs))
    3636
    3737    if version_major == 1:
  • issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py

    r25099 r25100  
    2626
    2727    # Get Gmsh version
    28     args = "gmsh -info | grep 'Version' | sed -e 's/Version[[:blank:]]*:[[:blank:]]//' | cut -d '.' -f1"
    29     proc = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    30     outs, errs = proc.communicate()
     28    subproc_args = "gmsh -info | grep 'Version' | sed -e 's/Version[[:blank:]]*:[[:blank:]]//' | cut -d '.' -f1"
     29    subproc = subprocess.Popen(subproc_args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     30    outs, errs = subproc.communicate()
    3131    if errs != '':
    3232        raise Exception("gmshplanet: call to gmsh failed: {}".format(errs))
    3333    gmshmajorversion = int(outs)
    3434    if gmshmajorversion not in [3, 4]:
    35         raise RuntimeError("gmshplanet: Gmsh major version {} not supported!".format( gmshmajorversion))
     35        raise RuntimeError("gmshplanet: Gmsh major version {} not supported!".format(gmshmajorversion))
    3636
    3737    #process options
Note: See TracChangeset for help on using the changeset viewer.