I'm trying to find the parent directory of the directory that my script is located in:
this = pathlib.Path(__name__)
parent = this.parent
parent2 = parent.parent
But printing them out shows that the second .parent
isn't working:
print(this, this.absolute())
print(parent, parent.absolute())
print(parent2, parent2.absolute())
print(this.parent == this.parent.parent)
Yields the output of:
__main__ C:\Users\Markus\Projects\PathTest\bin\__main__
. C:\Users\Markus\Projects\PathTest\bin
. C:\Users\Markus\Projects\PathTest\bin
True
I'm clueless, what could be the issue?