summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-01-26 16:00:38 -0800
committerRoss Brattain <ross.b.brattain@intel.com>2017-02-08 06:25:39 +0000
commit89f7f07398e8219656fa7e25f7b1a32692b280a9 (patch)
tree33671c1dd72de20b5521ac6acadc532607615bfd /api
parenta4241e6e9b121447a50fdfe0d79b322c2e2aaea9 (diff)
Bugfix: write_json_to_file: use json.dump with files
In python3 file objects automatically handle encoding to utf-8 and expect string, not bytes, so use regular json.dump() with the file object We should only use dump_as_bytes to replace json.dumps(), not to replace json.dump() This fixes Python3 issue: Traceback (most recent call last): File "yardstick/main.py", line 52, in <module> main() File "yardstick/main.py", line 49, in main YardstickCLI().main(sys.argv[1:]) File "yardstick/yardstick/cmd/cli.py", line 167, in main self._dispath_func_notask() File "yardstick/yardstick/cmd/cli.py", line 145, in _dispath_func_notask func(CONF.category) File "yardstick/yardstick/cmd/commands/task.py", line 48, in do_start self._init_result_file() File "yardstick/yardstick/cmd/commands/task.py", line 57, in _init_result_file write_json_to_file(consts.DEFAULT_OUTPUT_FILE, data) File "yardstick/yardstick/common/utils.py", line 152, in write_json_to_file write_file(path, jsonutils.dump_as_bytes(data), mode) File "yardstick/yardstick/common/utils.py", line 157, in write_file f.write(data) TypeError: write() argument must be str, not bytes Change-Id: I573419be25d8fa1f015e1507730ba66c05f86686 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'api')
0 files changed, 0 insertions, 0 deletions