From: Yang Zhao <yang.zhao@skyboxlabs.com>
To: git@vger.kernel.org
Cc: Yang Zhao <yang.zhao@skyboxlabs.com>
Subject: [RFC PATCH 3/4] git-p4: open .gitp4-usercache.txt in text mode
Date: Wed, 27 Nov 2019 17:28:06 -0800 [thread overview]
Message-ID: <20191128012807.3103-4-yang.zhao@skyboxlabs.com> (raw)
In-Reply-To: <20191128012807.3103-1-yang.zhao@skyboxlabs.com>
Opening .gitp4-usercache.txt in text mode makes python 3 happy without
explicitly adding encoding and decoding.
Signed-off-by: Yang Zhao <yang.zhao@skyboxlabs.com>
---
git-p4.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-p4.py b/git-p4.py
index d79cbf7005..6821d6aafd 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1387,14 +1387,14 @@ def getUserMapFromPerforceServer(self):
for (key, val) in self.users.items():
s += "%s\t%s\n" % (key.expandtabs(1), val.expandtabs(1))
- open(self.getUserCacheFilename(), "wb").write(s)
+ open(self.getUserCacheFilename(), 'w', encoding='utf-8').write(s)
self.userMapFromPerforceServer = True
def loadUserMapFromCache(self):
self.users = {}
self.userMapFromPerforceServer = False
try:
- cache = open(self.getUserCacheFilename(), "rb")
+ cache = open(self.getUserCacheFilename(), 'r', encoding='utf-8')
lines = cache.readlines()
cache.close()
for line in lines:
--
2.24.0.windows.2
next prev parent reply other threads:[~2019-11-28 1:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 1:28 [RFC PATCH 0/4] git-p4: python 3 compatability Yang Zhao
2019-11-28 1:28 ` [RFC PATCH 1/4] git-p4: decode response from p4 to str for python3 Yang Zhao
2019-11-28 1:28 ` [RFC PATCH 2/4] git-p4: properly encode/decode communication with git for python 3 Yang Zhao
2019-11-28 1:28 ` Yang Zhao [this message]
2019-11-28 1:28 ` [RFC PATCH 4/4] git-p4: use utf-8 encoding for file paths throughout Yang Zhao
2019-11-28 2:57 ` Elijah Newren
2019-11-28 12:54 ` [RFC PATCH 0/4] git-p4: python 3 compatability Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191128012807.3103-4-yang.zhao@skyboxlabs.com \
--to=yang.zhao@skyboxlabs.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).