From 9ea8ef518c2e8eb727d7fbc865ba5bea9cb26db4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 8 Jul 2018 13:02:37 +0530 Subject: [PATCH] Workaround for trailing \r on some windows systems --- src/calibre/utils/exim.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/exim.py b/src/calibre/utils/exim.py index 50f4ed9842..4ea7d47830 100644 --- a/src/calibre/utils/exim.py +++ b/src/calibre/utils/exim.py @@ -385,8 +385,10 @@ def cli_report(*args, **kw): pass -def run_exporter(): - export_dir = raw_input('Enter path to an empty folder (all exported data will be saved inside it): ').decode(filesystem_encoding) +def run_exporter(export_dir=None): + export_dir = export_dir or raw_input( + 'Enter path to an empty folder (all exported data will be saved inside it): ').decode( + filesystem_encoding).rstrip('\r') if not os.path.exists(export_dir): os.makedirs(export_dir) if not os.path.isdir(export_dir):