I need to create a file and write it in root mode. I tried with f = open("hola.log", 'w+')
but when I run it I get: PermissionError: [Errno 13] Permission denied
I'm working with python3. Any ideas?
I need to create a file and write it in root mode. I tried with f = open("hola.log", 'w+')
but when I run it I get: PermissionError: [Errno 13] Permission denied
I'm working with python3. Any ideas?
The solution was as simple as running the script with sudo. Thank you all
You can also change the file permissions with the chmod command:
chmod 777 'hola.log'
Indicating 777 you grant all the permissions to all the users, if you want to consult how to grant certain permissions only to certain users, consult the documentation. man chmod