diff --git a/opencage/batch.py b/opencage/batch.py index 1dcc44f..9b635cf 100644 --- a/opencage/batch.py +++ b/opencage/batch.py @@ -78,12 +78,16 @@ async def read_one_line(self, row, row_id): async def worker(self, output, queue, progress): while True: item = await queue.get() - await self.geocode_one_address(output, item['row_id'], item['address']) - if progress: - progress.update(1) + try: + await self.geocode_one_address(output, item['row_id'], item['address']) - queue.task_done() + if progress: + progress.update(1) + except Exception as exc: + traceback.print_exception(exc, file=sys.stderr) + finally: + queue.task_done() async def geocode_one_address(self, output, row_id, address): def on_backoff(details):