Gregory Ewing wrote: >>>>> ntpath.join('d:\\foo', '\\bar') >> '\\bar' > > This does seem like a bug, though -- the correct result > should really be 'd:\\bar', since that's what you would > get if you used the name '\\bar' with 'd:' as your current > drive.
No, it's not a bug. Since \bar is an absolute path, all path segments before the absolute path are ignored. This is documented at http://docs.python.org/library/os.path.html#os.path.join >>> ntpath.isabs("\\bar") True >>> ntpath.join("ignored", "\\bar") '\\bar' Posixpath follows the same rules, too. >>> posixpath.join("..", "egg", "/var") '/var' >>> posixpath.join("..", "egg", "var") '../egg/var' Christian -- http://mail.python.org/mailman/listinfo/python-list