sudo open() ? (python newbee question)

slava at crackpot.org slava at crackpot.org
Tue Jun 14 05:21:48 EDT 2005


hello,

i am writing a python script that will be run by a non root user
the script needs to open a file in write mode that is owned by root

file = open('/etc/apt/sources.list', 'r+')

returns permission error

how can i call sudo on open()?

thanks alot
slava



More information about the Python-list mailing list