Troubleshooting¶
Common issues and solutions when using pytaskwarrior.
task binary not found¶
Since pytaskwarrior 3.0, the task binary is not required by default.
TaskWarrior() uses the taskchampion backend directly.
If you explicitly pass task_cmd="task" and get this error:
Either remove the task_cmd argument to use the default backend, or install TaskWarrior:
# macOS
brew install task
# Ubuntu / Debian
sudo apt install taskwarrior
# Non-standard location
tw = TaskWarrior(task_cmd="/usr/local/bin/task")
Wrong Python version¶
Requirements: - Python ≥ 3.12
taskchampion-py not installed or wrong version¶
Symptom: ModuleNotFoundError: No module named 'taskchampion'
Fix:
pytaskwarrior requires taskchampion-py >= 3.0.1.1.
UDA not appearing on tasks¶
Symptom: task.get_uda("my_field") always returns None.
-
UDA not registered — declare the UDA before creating tasks:
-
Task created before the UDA was defined — re-add the UDA config and verify with
tw.get_uda_config("severity"). -
Wrong field name — UDA names are case-sensitive and must match the name used in
UdaConfig.
get_tasks() returns an empty list¶
-
Active context filtering — if a context is active, it filters all queries:
-
Wrong
data_location— pointing to a different directory: -
Filter too restrictive — try without a filter first:
OR / AND filters not working¶
pytaskwarrior's Python filter engine does not support or, and, or
parenthesised expressions. All tokens are combined with implicit AND.
For complex boolean logic, filter in Python after retrieving tasks:
tasks = tw.get_tasks()
result = [t for t in tasks if "work" in (t.project or "") or "urgent" in (t.tags or [])]
Import error: ModuleNotFoundError: No module named 'taskwarrior'¶
Note: the pip package is pytaskwarrior, but the Python import is taskwarrior:
Still stuck?¶
- Open an issue on GitHub
- Check the API reference for correct method signatures