Re: Windows file paths, again

2009-10-22 Thread Matt McCredie
Dan Guido 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

Re: Windows file paths, again

2009-10-21 Thread Dave Angel
Dan Guido wrote: This doesn't give me quite the results I expected, so I'll have to take a closer look at my project as a whole tomorrow. The test cases clearly show the need for all the fancy parsing I'm doing on the path though. Looks like I'll return to this tomorrow and post an update as app

Re: Windows file paths, again

2009-10-21 Thread Jerry Hill
On Wed, Oct 21, 2009 at 5:40 PM, Dan Guido wrote: > This doesn't give me quite the results I expected, so I'll have to > take a closer look at my project as a whole tomorrow. The test cases > clearly show the need for all the fancy parsing I'm doing on the path > though. To get back to what I thi

Re: Windows file paths, again

2009-10-21 Thread Dan Guido
This doesn't give me quite the results I expected, so I'll have to take a closer look at my project as a whole tomorrow. The test cases clearly show the need for all the fancy parsing I'm doing on the path though. Looks like I'll return to this tomorrow and post an update as appropriate. Thanks fo

Re: Windows file paths, again

2009-10-21 Thread Terry Reedy
Dan Guido wrote: Hi Diez, The source of the string literals is ConfigParser, so I can't just mark them with an 'r'. Python string literals only exist in Python source code. Functions and methods only return *strings*, not literals. If you mistakenly put the str() representation of a string

Re: Windows file paths, again

2009-10-21 Thread Dan Guido
I'm writing a test case right now, will update in a few minutes :-). I'm using Python 2.6.x I need to read these values in from a configparser file or the windows registry and get MD5 sums of the actual files on the filesystem and copy the files to a new location. The open() method completely barf

Re: Windows file paths, again

2009-10-21 Thread Lie Ryan
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 contr

Re: Windows file paths, again

2009-10-21 Thread Dave Angel
Dan Guido wrote: Hi Diez, The source of the string literals is ConfigParser, so I can't just mark them with an 'r'. config =onfigParser.RawConfigParser() config.read(filename) crazyfilepath =onfig.get(name, "ImagePath") normalfilepath =ormalize_path(crazyfilepath) The ultimate origin of the st

Re: Windows file paths, again

2009-10-21 Thread Dan Guido
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 On Wed, Oct 21, 2009 at 3:50 PM, Anthony Tolle wrote: > On Oct 21, 3:20 pm, D

Re: Windows file paths, again

2009-10-21 Thread Ethan Furman
Dan Guido wrote: I'm trying to write a few methods that normalize Windows file paths. I've gotten it to work in 99% of the cases, but it seems like my code still chokes on '\x'. I've pasted my code below, can someone help me figure out a better way to write this? This seems overly complicated for

Re: Windows file paths, again

2009-10-21 Thread Anthony Tolle
On Oct 21, 3:20 pm, Dan Guido wrote: > Hi Diez, > > The source of the string literals is ConfigParser, so I can't just > mark them with an 'r'. > > config = ConfigParser.RawConfigParser() > config.read(filename) > crazyfilepath = config.get(name, "ImagePath") > normalfilepath = normalize_path(craz

Re: Windows file paths, again

2009-10-21 Thread Dan Guido
Hi Diez, The source of the string literals is ConfigParser, so I can't just mark them with an 'r'. config = ConfigParser.RawConfigParser() config.read(filename) crazyfilepath = config.get(name, "ImagePath") normalfilepath = normalize_path(crazyfilepath) The ultimate origin of the strings is the

Re: Windows file paths, again

2009-10-21 Thread Diez B. Roggisch
Dan Guido wrote: > I'm trying to write a few methods that normalize Windows file paths. > I've gotten it to work in 99% of the cases, but it seems like my code > still chokes on '\x'. I've pasted my code below, can someone help me > figure out a better way to write this? This seems overly complica

Windows file paths, again

2009-10-21 Thread Dan Guido
I'm trying to write a few methods that normalize Windows file paths. I've gotten it to work in 99% of the cases, but it seems like my code still chokes on '\x'. I've pasted my code below, can someone help me figure out a better way to write this? This seems overly complicated for such a simple prob