I understand my question is not that clear so let me try explaining it here.
What I am trying to do is suspend my computer after completing a certain task.
My script:
#my logic or task(Downloading a file)#
cmd = shlex.split("sudo pm-suspend")
>>> subprocess.call(cmd)
[sudo] password for noob:
As you can see it asks for my password but the problem is I will not be sitting on my system while the script is getting executed.
So, my question is how to handle this problem or what other alternative way exist to tackle this problem.
Python version is 2.7.3.
Assuming your pm-suspend is at
/usr/sbin/pm-suspendMake your sudoers entry in
/etc/sudoers: