I am trying to execute Python scripts in terminal.
Running in Python shell it does what it is supposed to. It will run without error but nothing happens when executed in terminal.
Once this is figured out would there be a more useful way to get the program to enter the 'timeAide' & 'cancelSleep' strings into the terminal plus enter Mac password. I planned on importing 'pyautogui' to get all that portion done but is there something better.
#!/usr/bin/env python
#sleepAide: user enters a number to put the computer to sleep
#command for sleep: sudo systemsetup -setcomputersleep 60
#command to cancel sleep: sudo systemsetup -setcomputersleep Never .
#check python version in terminal: python --version
#shebang line: '#!/usr/bin/python3.6'
#type " 'nano' nameFile.py" in terminal to view code Ex: 'nano namefile.py'
class Sleep(object):
def __init__(self):
self.sleepAide()
def sleepAide(time):
timeAide = 'sudo systemsetup -setcomputersleep '
cancelSleep = 'sudo systemsetup -setcomputersleep Never'
time = int(input('In how many minutes would you like to sleep? '))
if time > 0:
print(timeAide+' '+str(time))
elif time == -1:
print(cancelSleep)