Message238374
| Author |
Jeremy Goss |
| Recipients |
Jeremy Goss, The Compiler, python-dev, vinay.sajip |
| Date |
2015年03月18日.03:29:28 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1426649369.29.0.832919474571.issue23207@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年03月18日 03:29:29 | Jeremy Goss | set | recipients:
+ Jeremy Goss, vinay.sajip, python-dev, The Compiler |
| 2015年03月18日 03:29:29 | Jeremy Goss | set | messageid: <1426649369.29.0.832919474571.issue23207@psf.upfronthosting.co.za> |
| 2015年03月18日 03:29:29 | Jeremy Goss | link | issue23207 messages |
| 2015年03月18日 03:29:28 | Jeremy Goss | create |
|