From 893b72f0abe91978d4d24733d6df121da28e2103 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 11 Jul 2017 10:14:36 +0530 Subject: [PATCH] Nicer error message when user tries to use a directory as log file --- src/calibre/srv/standalone.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/srv/standalone.py b/src/calibre/srv/standalone.py index 13ca01b45b..b573f562fa 100644 --- a/src/calibre/srv/standalone.py +++ b/src/calibre/srv/standalone.py @@ -190,6 +190,10 @@ def main(args=sys.argv): raise SystemExit(e.message) opts.auto_reload_port = int(os.environ.get('CALIBRE_AUTORELOAD_PORT', 0)) opts.allow_console_print = 'CALIBRE_ALLOW_CONSOLE_PRINT' in os.environ + if opts.log and os.path.isdir(opts.log): + raise SystemExit('The --log option must point to a file, not a directory') + if opts.access_log and os.path.isdir(opts.access_log): + raise SystemExit('The --access-log option must point to a file, not a directory') server = Server(libraries, opts) if getattr(opts, 'daemonize', False): if not opts.log and not iswindows: