Reputation: 133
I am using python and trying to execute a system command as below
code.py
import commands
import os
os.system('updatedb')
result:
sh-4.2$ python code.py
updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'
So how to execute all the system commands like above from a python module ?
Upvotes: 0
Views: 432
Reputation: 4791
This is almost certainly simply a permissions problem. If you can trust your script to run as root:
$ sudo python code.py
Upvotes: 3