From cd97b2c62070e1ef9f16e2083160f3804598ac7a Mon Sep 17 00:00:00 2001 From: chunfuwen Date: Mon, 7 May 2018 13:18:51 +0800 Subject: [PATCH] Python 3: fix re.search() using string pattern on a bytes-like object re.search(regexp, out) need regexp and out in the same type:string or bytes currently regexp is string,but out is bytes,which throw TypeError Fix this issue by transfering out into string forcedly Signed-off-by: chunfuwen --- avocado/utils/linux_modules.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avocado/utils/linux_modules.py b/avocado/utils/linux_modules.py index 63c59804..5eb78731 100644 --- a/avocado/utils/linux_modules.py +++ b/avocado/utils/linux_modules.py @@ -103,9 +103,9 @@ def loaded_module_info(module_name): dependent on, list of dictionary of param name and type :rtype: dict """ - l_raw = process.system_output('/sbin/lsmod') + l_raw = process.system_output('/sbin/lsmod').decode('utf-8') modinfo_dic = parse_lsmod_for_module(l_raw, module_name) - output = process.system_output("/sbin/modinfo %s" % module_name) + output = process.system_output("/sbin/modinfo %s" % module_name).decode('utf-8') if output: param_list = [] for line in output.splitlines(): -- GitLab