looker-open-source / henry

A command line tool for Looker instance cleanup
MIT License
79 stars 27 forks source link

Update default value of logfilename to use repr() #7

Closed coolbreezechloe closed 4 years ago

coolbreezechloe commented 4 years ago

Because the python logging module will do an eval() on the args parameter extra care must be taken to handle paths that may contain escape sequences. An import of the library failed on a windows machine where the path contains a folder called Users because on windows the separator is a backslash and the string became something like "c:\Users" which when passed as a default without using repr() caused the eval() to think this was a unicode escape sequence. The solution I have provided here wraps the default value passed in the dictionary with a repr() call and removes the surrounding single quotes in the logging.conf where that value is substituted into a tuple. The single quotes around the substitution marker are not needed any longer since repr() will generate them.