'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg' is a valid path. .. means parent, not 'go back a directory'. But you should really be trying this:
p1 = os.environ['HOMEPATH'] p2 = os.path.join(p1, 'Pictures', 'images', 'my.jpg') On Wed, 2011-02-02 at 20:46 -0800, harryos wrote: > In windows ,I tried this > > p1 = "C:\Users\me\Documents" > p2 = "..\Pictures\images\my.jpg" > > print os.path.join(p1,p2) > This gives > 'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg' > > I expected I would get > 'C:\\Users\\me\\Pictures\\images\\my.jpg' > > I thought os.path.join would join the paths more intelligently..Any > idea why this happens ? > harry > >
-- http://mail.python.org/mailman/listinfo/python-list