Dan Guido wrote:
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.

A path read from a file, config file, or winreg would never contain control characters unless they contains that a control character.

My crystal ball thinks that you used eval or exec somewhere in your script, which may cause a perfectly escaped path to get unescaped, like here:

# python 3
path = 'C:\\path\\to\\somewhere.txt'
script = 'open("%s")' % path    # this calls str(path)
exec(script)

OR

you stored the path incorrectly. Try seeing what exactly is stored in the registry using regedit.



Remember that escape characters doesn't really exist in the in-memory representation of the string. The escape characters exist only in string literals (i.e. source code) and when you print the string using repr().
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to