chr-1x / hmh_bot

Python modules for the Willie IRC bot used in the Handmade Hero twitch chat.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception while executing !schedule command

itsuart opened this issue · comments

Bot shows following, instead of proper information:

TypeError: can't subtract offset-naive and offset-aware datetimes (file "/home/pi/.willie/modules/handmade_stream.py", line 94, in getTimestamp)

Please review, I'm not sure my fix is proper.

It looks like it would fix the immediate issue, but I'm more curious why something is trying to pass a naive datetime to the function in the first place. Do you have the full stack trace around still?

Reproduced by commenting out my changes:

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/willie/bot.py", line 743, in call
exit_code = func(willie, trigger)
File "/home/itsuart/.willie/modules/handmade.py", line 108, in wrapperFunc
streaming = stream.isCurrentlyStreaming()
File "/home/itsuart/.willie/modules/handmade_stream.py", line 245, in isCurrentlyStreaming
streamTime = getNextStream(nowTime)
File "/home/itsuart/.willie/modules/handmade_stream.py", line 213, in getNextStream
today = StreamEpisode.FromDateTime(datetime.combine(streamDate, time(hour=hour)))
File "/home/itsuart/.willie/modules/handmade_stream.py", line 53, in FromDateTime
return StreamEpisode(streamDate=newTime.strftime("%Y%m%d"), startTime=getTimestamp(newTime))
File "/home/itsuart/.willie/modules/handmade_stream.py", line 97, in getTimestamp
td = dt - epoch
TypeError: can't subtract offset-naive and offset-aware datetimes

This is now, as far as I can tell, fixed.