diff --git a/linkcheck/command/setup_config.py b/linkcheck/command/setup_config.py index 3f7a1210..5d7e6a51 100644 --- a/linkcheck/command/setup_config.py +++ b/linkcheck/command/setup_config.py @@ -202,8 +202,11 @@ def setup_config(config, options): if options.useragent is not None: config["useragent"] = options.useragent if options.cookiefile is not None: - if fileutil.is_readable(options.cookiefile): - config["cookiefile"] = options.cookiefile - else: + if not fileutil.is_valid_config_source(options.cookiefile): + log.error( + LOG_CMDLINE, _("Cookie file %s does not exist."), options.cookiefile) + elif not fileutil.is_readable(options.cookiefile): msg = _("Could not read cookie file %s") % options.cookiefile log.error(LOG_CMDLINE, msg) + else: + config["cookiefile"] = options.cookiefile