[Baypiggies] os.path.join unexpected behavior on windows

Aahz aahz at pythoncraft.com
Wed Aug 27 17:07:28 CEST 2008

On Tue, Aug 26, 2008, William Deegan wrote:
> Here's the docs about os.path.join:
> join( path1[, path2[, ...]])
> Join one or more path components intelligently. If any component is an
> absolute path, all previous components (on Windows, including the
> previous drive letter, if there was one) are thrown away, and joining
> continues. The return value is the concatenation of path1, and
> optionally path2, etc., with exactly one directory separator (os.sep)
> inserted between components, unless path2 is empty. Note that on
> Windows, since there is a current directory for each drive,
> os.path.join("c:", "foo") represents a path relative to the current
> directory on drive C: (c:foo), not c:\\foo.
> I'm guessing I get : /build in because of the clause above about "if
> any component is an absolute path...", is that correct?

That seems correct; if you want more discussion I suggest you ask on
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Adopt A Process -- stop killing all your children!

More information about the Baypiggies mailing list