kostajh / taskwarrior-time-tracking-hook

A simple Taskwarrior hook allowing one to track total time spent on a task.
137 stars 24 forks source link

Time tracking hook can fail with "ValueError: invalid literal for int() with base 10" #17

Closed alexhunsley closed 6 years ago

alexhunsley commented 6 years ago

After a task was running for a while, if you do 'task X stop' you can get this:

tasksh> 2 stop
[task 2 stop]
Traceback (most recent call last):
  File "/Users/username/Dropbox/.task/hooks/on-modify.timetracking", line 11, in <module>
    sys.exit(cmdline())
  File "/Library/Python/2.7/site-packages/taskwarrior_time_tracking_hook/__init__.py", line 68, in cmdline
    sys.stdout.write(main())
  File "/Library/Python/2.7/site-packages/taskwarrior_time_tracking_hook/__init__.py", line 50, in main
    str(modified[UDA_KEY]).rstrip("seconds")
ValueError: invalid literal for int() with base 10: 'PT3H42M'
Hook Error: Expected feedback from a failing hook script.

It seems that the time tracking hook expects times stored in '12345seconds' format, but the task program sometimes writes duration data in a form such as 'PT3H42M'.

This look very similar to issue #16.