[issue19528] logger.config.fileConfig cant cope with files starting with an 'r' on windows

Peter Otten report at bugs.python.org
Fri Nov 8 17:37:53 CET 2013


Peter Otten added the comment:

Simon, in your code you build the config file with 

'''...
args=('{0}', 'a', 131072, 10)
...
'''.format(filename)

The logging module uses eval() to process the args tuple, and a filename containing a bashlash will not roundtrip that way. Have a look at the .conf file, it contains something like

args=('whatever\testlog\really_cool_logging.log', 'a', 131072, 10)

when it should be

args=('whatever\\testlog\\really_cool_logging.log', 'a', 131072, 10)

To fix this you should drop the quote chars and use the string representation of the filename:

'''...
args=({0!r}, 'a', 131072, 10)
...
'''.format(filename)

In short: I think Eric was right with initial assumption.

----------
nosy: +peter.otten

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19528>
_______________________________________


More information about the Python-bugs-list mailing list