From 02937216b0483e8d4dbe8cba570e53c32407231d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 10 Jan 2019 19:33:15 +0200 Subject: [PATCH] Fix "TypeError : startswith first arg" when checking udev rules with PY3 // Resolve #2000 --- platformio/util.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/platformio/util.py b/platformio/util.py index 3b5c16e9..c8637e29 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -818,14 +818,10 @@ def merge_dicts(d1, d2, path=None): def ensure_udev_rules(): def _rules_to_set(rules_path): - result = set([]) - with open(rules_path, "rb") as fp: - for line in fp.readlines(): - line = line.strip() - if not line or line.startswith("#"): - continue - result.add(line) - return result + return set([ + l.strip() for l in get_file_contents(rules_path).split("\n") + if l.strip() and not l.startswith("#") + ]) if "linux" not in get_systype(): return None