How can one disable forced sleep (sleep caused by the user - often by closing lid/pressing Sleep under the apple menu) through Terminal, preferably with a Python script, on OS X? I would like to be able to run the following or similiar...
import os
cmd = """ *?*Sleep Disable Command*?* """
def fullVolume():
os.system(cmd)
while True:
fullVolume()
...to accomplish said task.
I have done a fair share of research, and I couldn't find much, bar this: https://developer.apple.com/library/mac/qa/qa1340/_index.html
And this: https://code.google.com/p/macosx-nosleep-extension/ https://github.com/integralpro/nosleep/releases
I believe there may be some way to incorporate code from the NoSleep extension into this script, but I am quite unsure on how to do so. Help is much appreciated! =)