Merge pull request #378 from cclauss/patch-1

Use print() function in both Python 2 and Python 3
This commit is contained in:
Thomas Patzke 2019-06-26 15:15:49 +02:00 committed by GitHub
commit 0ea3a681df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,12 +162,12 @@ for file in glob.glob(args.ruledir + "/*"):
output_elast_config = re.sub(entry, str(convert_args[entry]), output_elast_config) output_elast_config = re.sub(entry, str(convert_args[entry]), output_elast_config)
for entry in translate_func: for entry in translate_func:
output_elast_config = re.sub(entry, translate_func[entry], output_elast_config) output_elast_config = re.sub(entry, translate_func[entry], output_elast_config)
print "Converting file " + file print("Converting file " + file)
with open(os.path.join(args.outdir, "sigma-" + file.split("/")[-1]), "w") as f: with open(os.path.join(args.outdir, "sigma-" + file.split("/")[-1]), "w") as f:
f.write(output_elast_config) f.write(output_elast_config)
except Exception as e: except Exception as e:
if args.debug: if args.debug:
traceback.print_exc() traceback.print_exc()
print "error " + str(file) + "----" + str(e) print("error " + str(file) + "----" + str(e))
pass pass