diff --git a/platformio/cache.py b/platformio/cache.py index 20901545..4b73bd67 100644 --- a/platformio/cache.py +++ b/platformio/cache.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import codecs import hashlib import os from time import time @@ -57,7 +56,7 @@ class ContentCache: cache_path = self.get_cache_path(key) if not os.path.isfile(cache_path): return None - with codecs.open(cache_path, "rb", encoding="utf8") as fp: + with open(cache_path, "r", encoding="utf8") as fp: return fp.read() def set(self, key, data, valid): @@ -78,7 +77,7 @@ class ContentCache: if not os.path.isdir(os.path.dirname(cache_path)): os.makedirs(os.path.dirname(cache_path)) try: - with codecs.open(cache_path, mode="wb", encoding="utf8") as fp: + with open(cache_path, mode="w", encoding="utf8") as fp: fp.write(data) with open(self._db_path, mode="a", encoding="utf8") as fp: fp.write("%s=%s\n" % (str(expire_time), os.path.basename(cache_path))) diff --git a/platformio/project/integration/generator.py b/platformio/project/integration/generator.py index 3cb677f1..53d229ea 100644 --- a/platformio/project/integration/generator.py +++ b/platformio/project/integration/generator.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import codecs import os import sys @@ -167,12 +166,12 @@ class ProjectGenerator: @staticmethod def _render_tpl(tpl_path, tpl_vars): - with codecs.open(tpl_path, "r", encoding="utf8") as fp: + with open(tpl_path, "r", encoding="utf8") as fp: return bottle.template(fp.read(), **tpl_vars) @staticmethod def _merge_contents(dst_path, contents): if os.path.basename(dst_path) == ".gitignore" and os.path.isfile(dst_path): return - with codecs.open(dst_path, "w", encoding="utf8") as fp: + with open(dst_path, "w", encoding="utf8") as fp: fp.write(contents)