diff options
author | Ali Saidi <Ali.Saidi@ARM.com> | 2012-01-10 10:17:33 -0600 |
---|---|---|
committer | Ali Saidi <Ali.Saidi@ARM.com> | 2012-01-10 10:17:33 -0600 |
commit | 8f18898e85ade3233502acd0dbc7cf9cd416d880 (patch) | |
tree | 8016e12e7e31eb31fb8d1a96585e6fb69bf2b43a /src | |
parent | e826d23a2eae6136f20f74d8d48601ff49349e58 (diff) | |
download | gem5-8f18898e85ade3233502acd0dbc7cf9cd416d880.tar.xz |
config: Fix json output for Python lt 2.6.
Diffstat (limited to 'src')
-rw-r--r-- | src/python/m5/simulate.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py index 29d14f75d..38129592c 100644 --- a/src/python/m5/simulate.py +++ b/src/python/m5/simulate.py @@ -31,7 +31,6 @@ import atexit import os import sys -import json # import the SWIG-wrapped main C++ functions import internal @@ -74,10 +73,14 @@ def instantiate(ckpt_dir=None): ini_file.close() if options.json_config: - json_file = file(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() + try: + import json + json_file = file(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() + except ImportError: + pass # Initialize the global statistics |