From c5e30d23ebc878acb8e16e025b6f55aaab43f3a5 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 15 May 2016 12:27:51 -0700 Subject: change to handle py3 changes to byte/string for open().write() --- QMTest/TestCmd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 198f586..2fba0a0 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -1731,7 +1731,11 @@ class TestCmd(object): file = self.canonicalize(file) if mode[0] != 'w': raise ValueError("mode must begin with 'w'") - open(file, mode).write(content) + try: + open(file, mode).write(content) + except TypeError as e: + # python 3 default strings are not bytes, but unicode + open(file, mode).write(bytes(content,'utf-8')) # Local Variables: # tab-width:4 -- cgit v0.12