Web lists-archives.com

[PATCH 3/3] contrib: hg-to-git: convert data to bytes for os.write




From: Jelle van der Waa <jelle@xxxxxxxx>

In Python 3 os.write wants bytes instead of a string, decode the str in
to bytes.

Signed-off-by: Jelle van der Waa <jelle@xxxxxxxx>
---
 contrib/hg-to-git/hg-to-git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index d504624c63..26c7300011 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -178,7 +178,7 @@ def getgitenv(user, date):
     #get comment
     (fdcomment, filecomment) = tempfile.mkstemp()
     csetcomment = os.popen('hg log -r %d --template "{desc}"' % cset).read().strip()
-    os.write(fdcomment, csetcomment)
+    os.write(fdcomment, csetcomment.encode())
     os.close(fdcomment)
 
     print('-----------------------------------------')
-- 
2.21.0