From: Oleg Broytman Date: Sat, 11 Nov 2023 18:33:45 +0000 (+0300) Subject: Fix(Py3): Open files in text mode X-Git-Tag: 5.0.0~61 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=5b6a905286a97f04db40dad41c69ddb7d6e33da6;p=bookmarks_db.git Fix(Py3): Open files in text mode --- diff --git a/Robots/bkmk_rurllib.py b/Robots/bkmk_rurllib.py index 00a4a42..93dbae8 100644 --- a/Robots/bkmk_rurllib.py +++ b/Robots/bkmk_rurllib.py @@ -102,7 +102,7 @@ class robot_urllib(robot_base): # Remove Accept-Charset del urllib._urlopener.addheaders[-1] - infile = open(fname, 'rb') + infile = open(fname, 'rt') content = infile.read() infile.close() diff --git a/Storage/bkmk_stjson.py b/Storage/bkmk_stjson.py index a748f0e..1d34cbd 100644 --- a/Storage/bkmk_stjson.py +++ b/Storage/bkmk_stjson.py @@ -91,7 +91,7 @@ class storage_json(Walker): def store(self, root_folder): root_folder.walk_depth(self) - outfile = open(self.filename, 'wb') + outfile = open(self.filename, 'wt') json.dump(self.dict, outfile) outfile.close() del self.dict diff --git a/Storage/debug-json/pprint-json.py b/Storage/debug-json/pprint-json.py index 48bb8b4..b90f9f0 100755 --- a/Storage/debug-json/pprint-json.py +++ b/Storage/debug-json/pprint-json.py @@ -4,7 +4,7 @@ import sys import json from pprint import pprint -infile = open(sys.argv[1], 'rb') +infile = open(sys.argv[1], 'rt') bkmk_s = infile.read() infile.close()