Skip to content

Commit

Permalink
Fix compatibility regression in inspector output module. (#706)
Browse files Browse the repository at this point in the history
* Fix compatibility regression in inspector output module.

* Explicit version-specific branching.

* Better Python3 compatibility approach.

* Remove extraneous sys import.
  • Loading branch information
jettisonjoe authored and Kenadia committed Jan 23, 2018
1 parent 29559ec commit acce2f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions openhtf/output/callbacks/mfg_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
import os
import threading
import zlib
try:
from past.types import unicode
except ImportError:
pass

import httplib2
import oauth2client.client
Expand Down Expand Up @@ -155,8 +159,8 @@ def _extract_attachments(phase, testrun, used_parameter_names):
name = _ensure_unique_parameter_name(name, used_parameter_names)
testrun_param = testrun.info_parameters.add()
testrun_param.name = name
if isinstance(attachment_data, str):
attachment_data = attachment_data.encode('utf8')
if isinstance(attachment_data, unicode):
attachment_data = attachment_data.encode('utf-8')
testrun_param.value_binary = attachment_data
if mimetype in MIMETYPE_MAP:
testrun_param.type = MIMETYPE_MAP[mimetype]
Expand Down

0 comments on commit acce2f4

Please sign in to comment.