I'm trying to make this directory /var/machine/hi'
by running this in Python:
os.mkdir("/var/machine/hi")
However, I'm getting a
OSError: [Errno 13] Permission denied: '/var/machine/hi'
I have tried the following:
chmod 777 /var/machine
and chmod 777 /var
The owners for /var
is root
wheel
The owners for /var/machine
is root
wheel
How can I fix/debug this?
Have you tried using os.system with a sudo command on the operation only?
os.system("sudo mkdir /var/machine/hi")