def run_neuron_dump()

in src/neuron-gatherinfo/neuron-gatherinfo.py [0:0]


def run_neuron_dump(outdir, verbose):
    '''
        function to call the existing neuron-dump.py tool

        Args:
            outdir  : destination location
            verbose : flag to indicate if verbose messages need to be displayed

        Output:
            tarball created by this tool

        Returns:

    '''

    if not os.path.isfile(NEURONDUMPPROGRAM):
        print(NEURON_ERRMSG)
        return

    cmd = "{} -o {}".format(NEURONDUMPPROGRAM, os.path.join(outdir, NEURONDUMPFILE))

    if verbose:
        print("Executing command: {}".format(cmd))

    try:
        res = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                               stderr=subprocess.STDOUT, universal_newlines=True,
                               shell=True)
        stdout, stderr = res.communicate()
        if stderr is not None:
            print("Error in executing cmd: {}\nError: {}\n".format(cmd, str(stderr)))
    except (OSError, ValueError) as err:
        print("Error in executing cmd: {}\nError: {}\n".format(cmd, err))

    if verbose:
        print("Output of cmd: {}\n{}".format(cmd, stdout))