I'm working on a Python script that creates text files containing size/space information about the directories that the script is run on. The script needs to be run as root, and as a result, it sets the text files that it creates to root's ownership.
I know I can change the ownership with os.fchown, but how do I pass fchown the uid and gid of the directory that the script is running on?