Everything works great except for the commented out code at the bottom.
import pyinputplus as pyip
import subprocess
from datetime import datetime
from time import sleep
# INPUT:
print()
print(' Welcome to AutoProgramStart')
print('I start programs at the time specified')
print()
print('Select the items below by number')
program_to_start = pyip.inputMenu(['Audiobook', 'Word', 'Excel', 'Notepad',
'Alarm'], numbered=True)
print('Use this format for time to start program: 14:58:16')
time_to_start_program = pyip.inputTime('Input time to start: ')
print(time_to_start_program)
now = datetime.now()
current_time = now.strftime("%H:%M:%S") # Get current time
print("Current Time in twenty four hour format =", current_time)
print('Time to start program ', time_to_start_program)
# if current_time > time_to_start_program:
# sleep(60) # This give us the one-minute accuracy instead of 1 second
# print('After sleep(60), This is where the alarm goes')
# OUTPUT:
subprocess.Popen(['start', 'alarm.wav'], shell=True) # Start sound alarm
I get this when the commented is uncommented.
Welcome to AutoProgramStart
I start programs at the time specified
Select the items below by number
Please select one of the following:
1. Audiobook
2. Word
3. Excel
4. Notepad
5. Alarm
1
Use this format for time to start program: 14:58:16
Input time to start: 17:30:00
17:30:00
Traceback (most recent call last):
File "C:/Users/Leonard Dye/PycharmProjects/AutoStart2/input menu.py", line 21, in <module>
print("Current Time in twenty four hour format =", current_time)
ValueError: invalid literal for int() with base 10: '17:25:49'``
I seems to me that on the concept of the “Black Box”, one whould assume you could compare the two time values.