From d627a42268ee225d91f6a256220c002ec7418e75 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 Jan 2019 14:07:35 +0200 Subject: [PATCH] Fix PyLint warning --- platformio/util.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platformio/util.py b/platformio/util.py index 11364072..5fe186d7 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -794,6 +794,15 @@ def merge_dicts(d1, d2, path=None): return d1 +def get_file_contents(path): + try: + with open(path) as f: + return f.read() + except UnicodeDecodeError: + with open(path, encoding="latin-1") as f: + return f.read() + + def ensure_udev_rules(): def _rules_to_set(rules_path):