--- a/eric6/UI/CompareDialog.py Tue Oct 13 19:02:26 2020 +0200 +++ b/eric6/UI/CompareDialog.py Wed Oct 14 17:50:39 2020 +0200 @@ -237,9 +237,8 @@ """ filename1 = self.file1Picker.text() try: - f1 = open(filename1, "r", encoding="utf-8") - lines1 = f1.readlines() - f1.close() + with open(filename1, "r", encoding="utf-8") as f1: + lines1 = f1.readlines() except IOError: E5MessageBox.critical( self, @@ -251,9 +250,8 @@ filename2 = self.file2Picker.text() try: - f2 = open(filename2, "r", encoding="utf-8") - lines2 = f2.readlines() - f2.close() + with open(filename2, "r", encoding="utf-8") as f2: + lines2 = f2.readlines() except IOError: E5MessageBox.critical( self,