osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

absolute path to a file


> On Sat, Aug 17, 2019 at 2:27 AM Paul St George <email at paulstgeorge.com> wrote:
> 
>>BUT does not work with
>>| print('test2:',os.path.realpath(n.image.filepath))|
>>
>>This returns only
>>|/image01.tif|

What does n.image.filepath look like on its own? If it starts
with a leading slash, then os.path.realpath will think it's
already an absolute path and leave it alone.

The problem then is why it's getting a leading slash in the
first place. It looks like the result of something naively
trying to append a filename to an empty directory path.

-- 
Greg