Execute pParse with the specified parameter file.

    :param paramPath: location of the pParse parameter file
    :param executable: must specify the complete file path of the pParse.exe
        if its location is not in the ``PATH`` environment variable.

    :returns: :func:`subprocess.Popen` return code, 0 if pParse was executed
        successful

def execute(paramPath, executable='pParse.exe'):
    """Execute pParse with the specified parameter file.

    :param paramPath: location of the pParse parameter file
    :param executable: must specify the complete file path of the pParse.exe
        if its location is not in the ``PATH`` environment variable.

    :returns: :func:`subprocess.Popen` return code, 0 if pParse was executed
        successful
    """
    procArgs = [executable, paramPath]

    ## run it ##
    proc = subprocess.Popen(procArgs, stderr=subprocess.PIPE)

    ## But do not wait till netstat finish, start displaying output immediately ##
    while True:
        out = proc.stderr.read(1)
        if out == '' and proc.poll() != None:
            break
        if out != '':
            sys.stdout.write(out)
            sys.stdout.flush()

    return proc.returncode