how can i create new file in /var/log directory using python language in OSX leopard? i tried to do it using os.open function but i get "permission denied"
thanks in advance
how can i create new file in /var/log directory using python language in OSX leopard? i tried to do it using os.open function but i get "permission denied"
thanks in advance
Only root can write in /var/log/ on Mac OS X...:
$ ls -ld /var/log drwxr-xr-x 60 root wheel 2040 Oct 6 17:00 /var/log Maybe consider using the syslog module in the standard library...
import syslog of course -- see docs.python.org/library/syslog.html for all the details!It probably failed because /var/log has user set to root and group set to wheel. Try running your python code as root and it will probably work.