From 0420e4a66f0ac525c9a8dcd6102cf0144851d25f Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 19 Jan 2021 11:44:04 -0600 Subject: [PATCH] Always close the file after getting column headers --- src/pgwui_bulk_upload/views/bulk_upload.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pgwui_bulk_upload/views/bulk_upload.py b/src/pgwui_bulk_upload/views/bulk_upload.py index 9d0c9bf..b540297 100644 --- a/src/pgwui_bulk_upload/views/bulk_upload.py +++ b/src/pgwui_bulk_upload/views/bulk_upload.py @@ -553,9 +553,10 @@ class BulkTableUploadHandler(BaseTableUploadHandler): map_description(fileinfo.filepath, fileinfo.relation), fileinfo.filepath, fileinfo.relation) errors.append(exp) - # Limit number of open files, close the file handle until it - # is time to read the file - fileinfo.close_fileo() + finally: + # Limit number of open files, close the file handle until it + # is time to read the file + fileinfo.close_fileo() if errors: raise core_ex.MultiError(errors) -- 2.34.1