From cb171db770ef0e97ab8b2b80c8a95c49ff792554 Mon Sep 17 00:00:00 2001 From: Corey O'Brien Date: Thu, 6 Apr 2017 09:17:26 -0400 Subject: [PATCH] Use universal_newlines with subprocess.check_output Python 3 will complain when trying to split a byte-string using a string so this change enables universal_newlines to make the split work in both python 2 and 3. Also add a py3 tox environment. Change-Id: I9af74b6c6cc9cfd0c973c85be04791aa6dc0acd4 --- os_collect_config/config_drive.py | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/os_collect_config/config_drive.py b/os_collect_config/config_drive.py index f64952b..3fcf23d 100644 --- a/os_collect_config/config_drive.py +++ b/os_collect_config/config_drive.py @@ -147,7 +147,7 @@ def all_block_devices(): '''Run blkid and yield a BlockDevice for all devices.''' try: cmd = ['blkid', '-o', 'export'] - out = subprocess.check_output(cmd) + out = subprocess.check_output(cmd, universal_newlines=True) except Exception as e: logger.error('Problem running "%s": %s', ' '.join(cmd), e) else: diff --git a/tox.ini b/tox.ini index 0964960..dd75919 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] minversion = 2.0 skipsdist = True -envlist = py27,pep8 +envlist = py35,py27,pep8 [testenv] usedevelop = True