From 9304bf3c6efe3571ac688c4101fed4aa69b21cde Mon Sep 17 00:00:00 2001 From: Numerlor Date: Thu, 18 Jul 2019 01:16:14 +0200 Subject: [PATCH] check if file is not found on size check --- MainWindows.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MainWindows.py b/MainWindows.py index d4fb44b0..a6c82e66 100644 --- a/MainWindows.py +++ b/MainWindows.py @@ -772,11 +772,11 @@ def change_status(self, message): def cs_submit_act(self, cpath): self.cs_submit.setEnabled(False) - if os.stat(cpath).st_size > 2_097_152: - self.status.showMessage("File too large") - self.cs_submit.setEnabled(True) - else: - try: + try: + if os.stat(cpath).st_size > 2_097_152: + self.status.showMessage("File too large") + self.cs_submit.setEnabled(True) + else: with open(cpath, encoding='utf-8') as f: data = [] valid = True @@ -804,8 +804,8 @@ def cs_submit_act(self, cpath): self.status.showMessage("Error loading csv file") self.cs_submit.setEnabled(True) - except FileNotFoundError: - self.status.showMessage("Invalid path to CSV file") + except FileNotFoundError: + self.status.showMessage("Invalid path to CSV file") def last_submit_act(self): self.last_submit.setEnabled(False)