On 05/31/2013 05:27 AM, Luca Cerone wrote:
fd = open('/etc/file','w')

fd.write('jpdas')

fd.close()


Hi Bibhu, that is not a Python problem, but a permission one.
You should configure the permissions so that you have write access to the 
folder.
However unless you know what you are doing it is discouraged to save your
file in the /etc/ folder.

I don't know if on Mac the commands are the same, but in Unix systems (that I 
guess Mac is) you can manage permissions with chmod.


That directory is protected from users for a reason. You defeat that and risk the system.

Bibhu: for that reason I'd suggest simply telling your users to run your script as root. If they trust you, and it breaks something, at least they know why they were doing it.

   sudo  python  riskyscript.py




--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to