An encounter with a bug with the default Timewarrior hook for Taskwarrior and a quick fix.

The encounter

I needed a new time tracking piece of software and I didn’t feel like using a cloud service. I started using Taskwarrior for tasks and saw it had a time tracking counter part.

I put in the hook as detailed on the site but there was an error and it didn’t activate the time tracking.

The fix

Option 1

I found the encoding to utf-8 broke the script as it was returning a byte not a string so I removed it in the 3 places it is used.

You can add a .decode(“utf-8”) after the strip() instead if your paranoid about keeping the strip()

That fixed it and it’s working fine.

Option 2

As it looks like python 3 vs python 2 issue. You can change the alias for python from python3 to 2 instead as an alternative fix. But Python2 is getting close to end of life now.

bogdandrema at gmail dot com
Terms and conditions reserved