]> git.phdru.name Git - bookmarks_db.git/commitdiff
Fix(Py3): Open files in text mode
authorOleg Broytman <phd@phdru.name>
Sat, 11 Nov 2023 18:33:45 +0000 (21:33 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 12 Nov 2023 19:21:09 +0000 (22:21 +0300)
Robots/bkmk_rurllib.py
Storage/bkmk_stjson.py
Storage/debug-json/pprint-json.py

index 00a4a42b1824ce9fe37dc6cb2f9761cb65e7f3e5..93dbae8c62378297ed3fd013f3a56c129cbfb954 100644 (file)
@@ -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()
 
index a748f0e2ffa029270a2774b955495baa67613237..1d34cbddb68df94703690d696a14d47b4c3c94ae 100644 (file)
@@ -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
index 48bb8b459f7b9142163e2cee748af2af2bcb937b..b90f9f057ab80a88d7cc01b9e4f0881e52798bef 100755 (executable)
@@ -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()