Jeremy Goss added the comment:

The argument validation in basicConfig has introduced another problem.
I cannot pass in an optional filename/filemode argument pair.

Previously, I passed in an optional logfile argument from ArgumentParser (which 
could be None). Now, I get a ValueError because filemode is not popped if 
filename is None.

logging.basicConfig(..., filename=args.logfile, filemode="w")
...
ValueError: Unrecognised argument(s): filemode

Suggested fix to place mode assignment alongside filename in basicConfig():
    filename = kwargs.pop("filename", None)
    mode = kwargs.pop("filemode", 'a')
    if filename:
        h = FileHandler(filename, mode)

----------
nosy: +Jeremy Goss

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23207>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to