From: Karl O. Pinc Date: Tue, 19 Jan 2021 17:44:04 +0000 (-0600) Subject: Always close the file after getting column headers X-Git-Url: https://papio.biology.duke.edu/gitweb/?a=commitdiff_plain;h=0420e4a66f0ac525c9a8dcd6102cf0144851d25f;p=pgwui_bulk_upload Always close the file after getting column headers --- 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)