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

absolute path to a file

On 16/08/2019 18:37, Chris Angelico wrote:
> 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|
>> Notes:
>> Chris, I only mention the extra leading slash on my Mac in case anyone
>> wonders why it is there. Python puts it there to escape the following slash.
> I still don't understand what you mean by that, because there's no
> concept of "escaping" with these slashes. It looks like you're
> actually working with absolute paths (starting with the leading slash)
> when you want to work with relative paths (NOT starting with a leading
> slash). The double slash isn't "escaping" anything, to my knowledge,
> and Python would not add it.
>  From the look of things, you really are getting a valid absolute path
> - "/image01.tif" is already absolute. It just isn't the path you want.
> ChrisA

Yes, perhaps I am using the wrong terms. I want to find the path that 
looks like this:

With such a path, I can find the image file. I cannot find the file with 
only /image01.tif

It is safe to ignore what I said about the double forward slashes. I am 
not using these. I only observed their presence and made a guess at 
their meaning.