Walter Doekes added the comment: Thanks for the quick response!
> Well, it's possible that you could configure handlers in the configuration > for later use (i.e. at some point after the dictConfig() call returns). After the dictConfig call returns, the StreamHandler/FileHandler is not referenced by anyone anymore. That's what causes the ResourceWarning. Unless I'm severely mistaken, there is no way to reach that old FileHandler instance. > If you want to avoid opening the file until it's actually needed, you can > specify delay=True. I am aware of that, but that's a workaround, not a fix. (And it has drawbacks of its own, for example in forking and/or setuid situations.) > Unless there's some reason you can't do that, or there's something I've > overlooked, I think I should close this as invalid. You could do that, but -- barring me overlooking something here -- I think that would only be correct if the dictionary that I passed to dictConfig is judged as being illegal, because it contains unused handlers. The ResourceWarning thrown is hard to understand because of where it is raised (at random points in a different modules), so like it is now, it may dissuade users from enabling more (visual) warnings. I'd rather see a warning raised earlier from dictConfig() that I configured an unused handler, so I have a better indication of what to fix. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23010> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com