def extant_file(file):
    """
    'Type' for argparse - checks that file exists but does not open.
    """
    if not os.path.exists(file):
        # Argparse uses the ArgumentTypeError to give a rejection message like:
        # error: argument input: file does not exist
        raise argparse.ArgumentTypeError("{0} does not exist".format(file))
    return file
def extant_file ( file ) : if not os . path . exists ( file ) : raise argparse . ArgumentTypeError ( "{0} does not exist" . format ( file ) ) return file
'Type' for argparse - checks that file exists but does not open.