Windows file paths, again

Matt McCredie mccredie at gmail.com
Wed Oct 21 17:01:15 EDT 2009


Dan Guido <dguido <at> gmail.com> writes:

> 
> Hi Anthony,
> 
> Thanks for your reply, but I don't think your tests have any control
> characters in them. Try again with a \v, a \n, or a \x in your input
> and I think you'll find it doesn't work as expected.
> 
> --
> Dan Guido


Why don't you try it yourself? He gave you the code. I changed cfg.ini to
contain the following:

[foo]
bar=C:\x\n\r\a\01\x32\foo.py


Which produced the following output:
C:\x\n\r\a\01\x32\foo.py
'C:\\x\\n\\r\\a\\01\\x32\\foo.py'

Looks like config parser worked just fine to me. There is a difference between a
python string literal written inside of a python script and a string read from a
file. When reading from a file (or the registry) what you see is what you get.
There is no need to do so much work. 

Matt McCredie







More information about the Python-list mailing list