Skip to content

Commit acce2f4

Browse files
jettisonjoeKenadia
authored andcommitted
Fix compatibility regression in inspector output module. (#706)
* Fix compatibility regression in inspector output module. * Explicit version-specific branching. * Better Python3 compatibility approach. * Remove extraneous sys import.
1 parent 29559ec commit acce2f4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

openhtf/output/callbacks/mfg_inspector.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
import os
3434
import threading
3535
import zlib
36+
try:
37+
from past.types import unicode
38+
except ImportError:
39+
pass
3640

3741
import httplib2
3842
import oauth2client.client
@@ -155,8 +159,8 @@ def _extract_attachments(phase, testrun, used_parameter_names):
155159
name = _ensure_unique_parameter_name(name, used_parameter_names)
156160
testrun_param = testrun.info_parameters.add()
157161
testrun_param.name = name
158-
if isinstance(attachment_data, str):
159-
attachment_data = attachment_data.encode('utf8')
162+
if isinstance(attachment_data, unicode):
163+
attachment_data = attachment_data.encode('utf-8')
160164
testrun_param.value_binary = attachment_data
161165
if mimetype in MIMETYPE_MAP:
162166
testrun_param.type = MIMETYPE_MAP[mimetype]

0 commit comments

Comments
 (0)