From 78f1896c699e71aa978d0350027cef0522b166d0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 17 Jul 2019 14:51:06 +0530 Subject: [PATCH] Windows: Fix calibre-server --manage-users not working correctly Apparently when running in the windows command prompy raw_input() returns a trailing carriage return --- src/calibre/srv/manage_users_cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/srv/manage_users_cli.py b/src/calibre/srv/manage_users_cli.py index 20268ab74e..b510d147ef 100644 --- a/src/calibre/srv/manage_users_cli.py +++ b/src/calibre/srv/manage_users_cli.py @@ -8,7 +8,7 @@ import sys from functools import partial from calibre import prints -from calibre.constants import preferred_encoding +from calibre.constants import preferred_encoding, iswindows from polyglot.builtins import iteritems, raw_input, filter, unicode_type # Manage users CLI {{{ @@ -24,6 +24,9 @@ def manage_users_cli(path=None): ans = raw_input() if isinstance(ans, bytes): ans = ans.decode(enc) + if iswindows: + # https://bugs.python.org/issue11272 + ans = ans.rstrip('\r') return ans def choice(