Skip to content

Commit

Permalink
Merge pull request #969 from xutian/fix_unicode
Browse files Browse the repository at this point in the history
virttest.utils_misc: fix unicode decode errors
  • Loading branch information
Xu Tian authored Mar 31, 2017
2 parents 8725e4d + 9043d26 commit 8355da4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions virttest/utils_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,9 @@ def log_line(filename, line):
pass
_open_log_files[base_file] = open(log_file, "w")
timestr = time.strftime("%Y-%m-%d %H:%M:%S")
_open_log_files[base_file].write("%s: %s\n"
% (timestr,
line.encode(ENCODING,
'ignore')))
line = unicode("%s: %s" % (timestr, line), errors="ignore")
line = line.encode(ENCODING, errors='ignore')
_open_log_files[base_file].write("%s\n" % line)
_open_log_files[base_file].flush()
finally:
_log_lock.release()
Expand Down

0 comments on commit 8355da4

Please sign in to comment.