Always close the file after getting column headers
authorKarl O. Pinc <kop@karlpinc.com>
Tue, 19 Jan 2021 17:44:04 +0000 (11:44 -0600)
committerKarl O. Pinc <kop@karlpinc.com>
Tue, 19 Jan 2021 17:44:04 +0000 (11:44 -0600)
src/pgwui_bulk_upload/views/bulk_upload.py

index 9d0c9bf6110b3255bcf587a580c7fa87edc18a22..b540297e2b3a2c21e834654157fcabd1acfae528 100644 (file)
@@ -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)