import asyncio from asyncio.exceptions import CancelledError files = ["image.png", "file.csv", "file1.txt"] async def download_file(file_name): pass async def main(): try: async with asyncio.TaskGroup() as tg: tasks = [tg.create_task(download_file(filename)) for filename in files] except* Exception as err: for error in err.exceptions: print(error)