From b3195c455bf5aed70d2543684f3c0bc7f36c8fcf Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Fri, 25 Jan 2019 12:03:21 +0000 Subject: python: Switch to using open instead of file Python 3 doesn't support the file(name, mode) syntax which has been deprecated in favour of open. Change-Id: I35ef8690d97a5243860a64ff985fd22fa86253f1 Signed-off-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/15985 Reviewed-by: Gabe Black Reviewed-by: Giacomo Travaglini --- src/python/m5/simulate.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/python/m5/simulate.py') diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py index 03cc253e9..d72dee222 100644 --- a/src/python/m5/simulate.py +++ b/src/python/m5/simulate.py @@ -92,7 +92,7 @@ def instantiate(ckpt_dir=None): for obj in root.descendants(): obj.unproxyParams() if options.dump_config: - ini_file = file(os.path.join(options.outdir, options.dump_config), 'w') + ini_file = open(os.path.join(options.outdir, options.dump_config), 'w') # Print ini sections in sorted order for easier diffing for obj in sorted(root.descendants(), key=lambda o: o.path()): obj.print_ini(ini_file) @@ -101,7 +101,8 @@ def instantiate(ckpt_dir=None): if options.json_config: try: import json - json_file = file(os.path.join(options.outdir, options.json_config), 'w') + json_file = open( + os.path.join(options.outdir, options.json_config), 'w') d = root.get_config_as_dict() json.dump(d, json_file, indent=4) json_file.close() -- cgit v1.2.3