I am writing a script to email the owner of a file when a separate process has finished. I have tried:
import os
FileInfo = os.stat("test.txt")
print (FileInfo.st_uid)
The output of this is the owner ID number. What I need is the Windows user name.
Once I stopped searching for file meta data and started looking for file security I found exactly what I was looking for.
Mercilessly ganked from http://timgolden.me.uk/python-on-windows/programming-areas/security/ownership.html