From 4fa6e6ff090552dd8099a20751e5a184a85d9ba1 Mon Sep 17 00:00:00 2001 From: Heitor Silva Date: Wed, 6 Jan 2016 11:47:16 -0200 Subject: [PATCH] Fixing the error 'must be char, not unicode' that happens on Windows for default Python getpass function --- jrnl/util.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jrnl/util.py b/jrnl/util.py index e9df0fb1..682814c4 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -28,7 +28,12 @@ log = logging.getLogger(__name__) def getpass(prompt="Password: "): if not TEST: - return gp.getpass(prompt) + try: + passwd = gp.getpass(prompt) + except TypeError: + passwd = gp.getpass(prompt.encode('ascii', 'ignore')) + + return passwd else: return py23_input(prompt)