I've written a script to work out the value with variable program_width, but I have got a weird error.
The error is: TypeError: unsupported operand type(s) for +: 'int' and 'str'
The error are jumping on this line:
program_start = 350 + program_width
Here is the code I use:
if datetime.timedelta(minutes = 10) <= program_duration <= datetime.timedelta(minutes = 30):
program_width = "250"
elif datetime.timedelta(hours = 1) <= program_duration <= datetime.timedelta(hours = 1.29):
program_width = "500"
elif datetime.timedelta(hours = 1.30) <= program_duration <= datetime.timedelta(hours = 1.45):
program_width = "750"
elif datetime.timedelta(hours = 1.46) <= program_duration <= datetime.timedelta(hours = 2):
program_width = "1000"
if program_width > 1:
if program_notification:
button_nofocus = 'channels_bar1.png'
button_focus = 'channels_yellow.png'
else:
button_nofocus = 'channels_bar1.png'
button_focus = 'channels_yellow.png'
if program_width < 65:
program_title = ''
else:
program_teststart = 350 + program_width
print program_teststart = 350 + program_width
I'm expecting to add the value with the variable program_width to get the return value, example: 350 + 500 = 850.
Do anyone know how to fix the error?