confusion regarding os.path.walk()

Steven Majewski sdm7g at Virginia.EDU
Mon Feb 18 19:19:50 EST 2002


On Tue, 19 Feb 2002, Ron Johnson wrote:

> Hello,
>
> In the visit callout function, it looks as though after the top level
> is processed, os.path.isfile() and os.path.isdir() both return 0 when
> passed elements from the names parameter.
>
> Am I doing something wrong?
>

You need to os.path.join() the dirname to the filename and do your
test on that. The filenames are relative to the directory arg,
not to the process current directory.

-- Steve Majewski







More information about the Python-list mailing list