confusion regarding os.path.walk()

Steven Majewski sdm7g at Virginia.EDU
Tue Feb 19 12:55:35 EST 2002


On Tue, 19 Feb 2002, Ron Johnson wrote:

>
> Thinking that that might be the problem, I used os.path.realpath().
> However, even that didn't work.  Why wouldn't testing an absolute
> filename work?
>

Testing an absolute filename *does* work.

If you print out what os.path.realpath() returns, you'll see that
it's returning an absolute path to a file that sometimes doesn't
exist. It isn't a DWIM function: os.path.realpath( 'XXXX' )
is just going to return "XXXX" appended onto the current directory
path. You still need to to explicitly join the directory path.

-- Steve Majewski







More information about the Python-list mailing list