I am developing project by using python script in Ubuntu 10.04. In my project,I need to reboot the system automatically at particular time period. So that,I was wrote the below command in my python script.
passwd = "my system password"
os.system('echo %(passwd)s | sudo reboot -f' %locals())
It was working fine but today when I run my script it throws the below error.
sudo no tty present and no askpass program specifiedHow to resolve this problem.I need to reboot my system through python script.If you know let me, your answer is very useful to me.
You can restart your computer through dbus, no password required.
(Taken from a previous answer of mine)
I've found very interesting information that could help your problem.
Source: Post #2 (by pludi) on sudo: no tty present and no askpass program specified (by linuxgeek)
For more information about this solution, see that forum discussion.