CSV module, DictReader problem (bug?)

2006-11-01 Thread Jeff Blaine
It's been a year or so since I written Python code, so maybe I am just doing something really dumb, but... Documentation = class DictReader(csvfile[,fieldnames=None, [,restkey=None[, restval=None[, dialect='excel' [, *args, **kwds])

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread Fredrik Lundh
Jeff Blaine wrote: It's been a year or so since I written Python code, so maybe I am just doing something really dumb, but... Documentation = class DictReader(csvfile[,fieldnames=None, [,restkey=None[, restval=None[, dialect='excel' [,

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread Jeff Blaine
I see what's wrong. Me. Wow am I ever rusty. Jeff Blaine wrote: It's been a year or so since I written Python code, so maybe I am just doing something really dumb, but... Documentation = class DictReader(csvfile[,fieldnames=None, [,restkey=None[,

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread John Machin
Jeff Blaine wrote: It's been a year or so since I written Python code, so maybe I am just doing something really dumb, but... Documentation = class DictReader(csvfile[,fieldnames=None, [,restkey=None[, restval=None[, dialect='excel' [, *args,

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread Tom Plunket
John Machin wrote: If you were to write 'c:\temp\book1.csv', it would blow up ... because \t - tab and \b - backspace. Get into the habit of *always* using raw strings r'C:\Temp\Book1.csv' for Windows file names (and re patterns). You could use double backslashing 'C:\\Temp\\Book1.csv' but

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread John Machin
Tom Plunket wrote: John Machin wrote: If you were to write 'c:\temp\book1.csv', it would blow up ... because \t - tab and \b - backspace. Get into the habit of *always* using raw strings r'C:\Temp\Book1.csv' for Windows file names (and re patterns). You could use double backslashing

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread skip
...alternatively you can just use 'unix slashes', e.g. 'c:/temp/book1.csv', since those work just fine 'cause the Windows APIs deal with them properly. John Not all APIs do the right thing. If you fire up the cmd.exe shell John and feed it slashes as path separators, it

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread Steve Holden
John Machin wrote: Tom Plunket wrote: John Machin wrote: If you were to write 'c:\temp\book1.csv', it would blow up ... because \t - tab and \b - backspace. Get into the habit of *always* using raw strings r'C:\Temp\Book1.csv' for Windows file names (and re patterns). You could use double

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread John Machin
On 2/11/2006 2:38 PM, [EMAIL PROTECTED] wrote: ...alternatively you can just use 'unix slashes', e.g. 'c:/temp/book1.csv', since those work just fine 'cause the Windows APIs deal with them properly. John Not all APIs do the right thing. If you fire up the cmd.exe shell

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread Fredrik Lundh
John Machin wrote: Not all APIs do the right thing. If you fire up the cmd.exe shell and feed it slashes as path separators, it barfs. Example: C:\junkdir c:/junk/*.bar Invalid switch - junk. Hence the advice to use rawstrings with backslashes -- they work under all circumstances.

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread Fredrik Lundh
Fredrik Lundh wrote: if you're wrapping some cmd.exe command in an internal API, it's usually easier to call os.path.normpath the last thing you do before you call os.system, than to get all the backslashes right in your code. also see: