On 15Aug2019 22:52, Manfred Lotz <[email protected]> wrote:
On Thu, 15 Aug 2019 22:00:17 +0200 Paul St George <[email protected]> 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.tifIf 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 <[email protected]> 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 <[email protected]> -- https://mail.python.org/mailman/listinfo/python-list
