On 15Aug2019 22:52, Manfred Lotz <ml_n...@posteo.de> wrote:
On Thu, 15 Aug 2019 22:00:17 +0200
Paul St George <em...@paulstgeorge.com> wrote:
But I want an absolute path such as:
---Plane uses image01.tif saved
at /Users/Lion/Desktop/test8/image01.tif ---Plane uses image02.tif
saved at /Users/Lion/Desktop/images/image02.tif

If it is relevant, my files are on a Mac. Hence the escaped forward
slash.

You don't need to double the leading slash on a Mac.

On 15Aug2019 22:52, Manfred Lotz <ml_n...@posteo.de> wrote:
I did this:
from pathlib import Path
abs_myfile = Path('./myfile').resolve()
which worked fine for me.

There is also os.path.realpath(filename) for this purpose. In modern Python that also accepts a Pathlike object.

Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to