You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to integrate Taskwarrior with Claws-mail client and for the purpose I've modified the mutt2task script as follows (my Python skills are very rusty):
#!/usr/bin/env python3
"""
Creates a new task with the given message's filename as annotation attachment.
"""
import email
import sys
from tasklib import TaskWarrior, Task
def get_task_description(message):
description = 'claws: "{}"'.format(message['subject'])
return description
def main():
try:
file_name = sys.argv[1]
fp = open(file_name)
message = email.message_from_file(fp)
desc = get_task_description(message)
tw = TaskWarrior(data_location='~/task', create=False)
task = Task(tw, description=desc, tags=['inbox','email'])
task.save()
task.add_annotation(str(file_name))
except Exception as e:
print(e)
sys.exit(2)
if __name__ == "__main__":
main()
which I try to use as Claws-mail's User Action.
The problem is that the script does not work all the time, iow. sometimes when invoked as:
Unique identifiers 177 with description: claws: "Re: Action to integrate Claws with Taskwarrior" matches multiple tasks: ['']
and sometimes it simply works correctly and creates a task with appropriate annotatation - I plan to add custom .desktop file to be able to use xdg-open to open annotated link with claws-mail --select somemsg.
Do you have any idea why the script does not work reliably?
Sincerely,
Gour
The text was updated successfully, but these errors were encountered:
tbabej
changed the title
annotation is not (always) added
Addition of task can create stale ID reference if GC has not been run
Sep 13, 2021
This turns out to be a problem with how taskwiki obtains ID references to newly added tasks. In particular, the above script fails to add annotation if and only if one runs a task done or task delete command prior to running it.
This happens because the mechanism for enforcing recurrence causes the TW to run a next report, which triggers GC and possibly invalidates the ID reference.
Hello,
I'm trying to integrate Taskwarrior with Claws-mail client and for the purpose I've modified the mutt2task script as follows (my Python skills are very rusty):
which I try to use as Claws-mail's User Action.
The problem is that the script does not work all the time, iow. sometimes when invoked as:
it produces the following output:
and sometimes it simply works correctly and creates a task with appropriate annotatation - I plan to add custom
.desktop
file to be able to usexdg-open
to open annotated link withclaws-mail --select somemsg
.Do you have any idea why the script does not work reliably?
Sincerely,
Gour
The text was updated successfully, but these errors were encountered: