Re: [Tutor] getting around ValueError in os.walk

2006-01-30 Thread John Fouhy
On 31/01/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > You need a comma after dirpath, python sees only two values > in the tuple but expects 3 (actually I'd expect a syntax error, > unless there is no space in the real code?) >>> 1 . __add__ ( 4 ) 5 Python is quite happy about whitespace either si

Re: [Tutor] getting around ValueError in os.walk

2006-01-30 Thread Andrew Fant
Mea culpa, Mea Maxima Culpa. I apoligize for sending quickly when I was trying to edit in vi. Thanks to everyone who caught my typo and explained ValueError to me in detail. Andy (vowing to RTFM more closely in the future) -- Andrew Fant| And when the night is cloudy| This space to l

Re: [Tutor] getting around ValueError in os.walk

2006-01-30 Thread Alan Gauld
> for (dirpath. subdirs, filenames) in os.walk("/foo/bar"): You need a comma after dirpath, python sees only two values in the tuple but expects 3 (actually I'd expect a syntax error, unless there is no space in the real code?) > when I try to run it, I get a "ValueError: too many values to unpac

Re: [Tutor] getting around ValueError in os.walk

2006-01-30 Thread John Fouhy
On 31/01/06, Andrew D. Fant <[EMAIL PROTECTED]> wrote: > when I try to run it, I get a "ValueError: too many values to unpack" which I > think comes from the fact that there is a subdirectory of /foo/bar which has > over 2500 files in it. The tree can't be easily restructured for legacy > reasons

Re: [Tutor] getting around ValueError in os.walk

2006-01-30 Thread Jason Massey
Andrew, I put in your code, exactly as you have it, with only three changes: #!/usr/bin/python import os for (dirpath, subdirs, filenames) in os.walk("/python24"):    # a comma instead of a period after dirpath    for file in filenames:    if file.endswith(".py"):

[Tutor] getting around ValueError in os.walk

2006-01-30 Thread Andrew D. Fant
I'm working on a program to do some processing on a directory tree. If I had been doing it in a shell script, the core of the processing would have been in a "find $ROOT -type f -name FOO -print" command" On the web, I found a snippet of code that demonstrated the os.walk module and I created a si