error message if output file could not be opened

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1878 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2004-10-27 12:22:46 +00:00
parent 97b8972bd8
commit ef26bd83db

View file

@ -427,7 +427,8 @@ if options.output:
(options.output, "'-o, --output'"))
if options.fileoutput:
ns = {'fileoutput': 1}
for ftype in options.fileoutput:
for arg in options.fileoutput:
ftype = arg
# look for (optional) filename and encoding
if '/' in ftype:
ftype, suffix = ftype.split('/', 1)
@ -446,11 +447,17 @@ if options.fileoutput:
else:
ns['filename'] = suffix
if linkcheck.Loggers.has_key(ftype):
logger = config.logger_new(ftype, **ns)
# generating loggers with fileoutput can throw
# an exception when opening the file
try:
logger = config.logger_new(ftype, **ns)
except OSError, msg:
printUsage(_("Illegal argument %r for option %s: %s") % \
(arg, "'-F, --file-output'", str(msg)))
config['fileoutput'].append(logger)
else:
printUsage(_("Illegal argument %r for option %s") % \
(ftype, "'-F, --file-output'"))
(arg, "'-F, --file-output'"))
if options.interactive is not None:
config['interactive'] = options.interactive
if options.intern: