comparing a directory to current dir...
Bjorn Pettersen
bjorn at roguewave.com
Fri Jul 14 14:26:06 EDT 2000
David Bolen wrote:
>
> "Jürgen Hermann" <jhe at webde-ag.de> writes:
>
> > "Bjorn Pettersen" <bjorn at roguewave.com> schrieb im Newsbeitrag
> > news:396B9C5E.FCE5F683 at roguewave.com...
> > > the problem is that os.path.abspath(os.curdir) contains the drive letter
> > > on Windows and os.path.abspath(directory) doesn't.
> (...)
> > Your windows must be different from mine. :) Mine is NT4SP6a.
>
> Either that or Bjorn doesn't have the win32 extensions installed. It
> turns out that ntpath.py in the standard library will actually try to
> use the win32 extensions to let NT produce the absolute path, but if
> not present will silently revert to internal functions, which can
> under some conditions produce the behavior Bjorn was seeing.
>
> It depends on os.path.isabs() being used to determine if the supplied
> string is already an absolute path, which it will say yes to if it
> starts with / or \, even if it doesn't have a drive. In that case, it
> doesn't do the join mentioned in the documentation, but only does
> os.path.normalize() and you can end up with a result without the drive
> letter.
>
> I guess the problem is that "absolute" is sort of ambiguous under
> Windows, since you can have absolute paths on your current drive, or a
> really absolute path that always includes the drive.
>
> It would probably help to see the value that was in "directory" from
> the original poster to know if that's what was up (and/or if he had
> the win32 extensions installed).
That's it! Thanks a bunch :-)
I-want-the-win32-extensions-in-the-core'ly y'rs
-- bjorn
More information about the Python-list
mailing list