From 925da9bbf3e77378c997452d330cfe4c9b8073e6 Mon Sep 17 00:00:00 2001 From: almaz Date: Tue, 8 Aug 2023 18:38:20 +0300 Subject: [PATCH] clean dir before download, fix result teamfiles path --- src/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index 1058bab..25ebbb3 100644 --- a/src/main.py +++ b/src/main.py @@ -97,7 +97,7 @@ def _print_progress(monitor, upload_progress): file_info = api.file.upload(TEAM_ID, result_archive, remote_archive_path, lambda m: _print_progress(m, upload_progress)) - app_logger.info("Uploaded to Team-Files: {!r}".format(file_info.storage_path)) + app_logger.info("Uploaded to Team-Files: {!r}".format(file_info.path)) api.task.set_output_archive(task_id, file_info.id, full_archive_name, file_url=file_info.storage_path) my_app.stop() @@ -105,6 +105,8 @@ def _print_progress(monitor, upload_progress): def download_json_plus_images(api, project, dataset_ids): sly.logger.info('DOWNLOAD_PROJECT', extra={'title': project.name}) download_dir = os.path.join(my_app.data_dir, f'{project.id}_{project.name}') + if os.path.exists(download_dir): + sly.fs.clean_dir(download_dir) sly.download_project(api, project.id, download_dir, dataset_ids=dataset_ids, log_progress=True, batch_size=batch_size) sly.logger.info('Project {!r} has been successfully downloaded.'.format(project.name))