diff --git a/convert-to-parquet/convert-to-parquet.py b/convert-to-parquet/convert-to-parquet.py index 2f716b436c80c339acd5063457e367334cd8f5a9..6fea930b5d231604580041ac755481c2350c6b99 100755 --- a/convert-to-parquet/convert-to-parquet.py +++ b/convert-to-parquet/convert-to-parquet.py @@ -21,9 +21,9 @@ def parse_args(): parser = argparse.ArgumentParser(description=desc, formatter_class=argparse.RawTextHelpFormatter ) - parser.add_argument('-p','--policy',help="Print the policy the script uses as a template and exit") + parser.add_argument('-p','--policy',help="Print the policy the script uses as a template and exit",action='store_true') parser.add_argument('-o','--output-dir',help="Directory to store the output parquet. The parquet file will have the same name as the input. Defaults to input_file_dir/parquet") - parser.add_argument('-f','--file',required=True,help="Log file from mmlspolicy run to be converted to parquet. Can be either a full log or just a part") + parser.add_argument('-f','--file',help="Log file from mmlspolicy run to be converted to parquet. Can be either a full log or just a part") args = parser.parse_args() return args @@ -96,11 +96,15 @@ def main(): print_policy() exit() - file = PurePath(args.file) - outdir = PurePath(args.output_dir) + if args.file: + file = PurePath(args.file) + else: + exit('Error: must specify a file to convert') - if not outdir: + if not args.output_dir: outdir = file.parent.joinpath('parquet') + else: + outdir = PurePath(args.output_dir) os.makedirs(outdir,exist_ok=True)