From cda79e2ecd51d125bbdd04ab83ddee5139b49313 Mon Sep 17 00:00:00 2001 From: Florian Preinstorfer Date: Tue, 26 Mar 2024 18:55:43 +0100 Subject: [PATCH] Fix TypeError for vja ls with task_ids The filter for task_ids now creates a list instead of a generator: * The `len()` function used to count the number of retrieved tasks does not support generators. This fixes: TypeError: object of type 'generator' has no len() * The tasks generator is always consumed by `application.output.task_array()` and the following count always shows 0. Creating a list before shows the correct task count. --- vja/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vja/cli.py b/vja/cli.py index 2efc2cb..753a97f 100755 --- a/vja/cli.py +++ b/vja/cli.py @@ -434,7 +434,7 @@ def task_ls(application, task_ids, is_json, is_jsonvja, custom_format, include_c tasks = application.query_service.find_filtered_tasks(include_completed, sort_string, filter_args) if task_ids: - tasks = (t for t in tasks if t.id in task_ids) + tasks = [t for t in tasks if t.id in task_ids] application.output.task_array(tasks, is_json, is_jsonvja, custom_format) if not is_json and not is_jsonvja and not custom_format: -- GitLab