--- a/eric6/E5Gui/E5MainWindow.py Tue Oct 13 19:02:26 2020 +0200 +++ b/eric6/E5Gui/E5MainWindow.py Wed Oct 14 17:50:39 2020 +0200 @@ -48,9 +48,8 @@ # step 2: set a style sheet if styleSheetFile: try: - f = open(styleSheetFile, "r", encoding="utf-8") - styleSheet = f.read() - f.close() + with open(styleSheetFile, "r", encoding="utf-8") as f: + styleSheet = f.read() except (IOError, OSError) as msg: E5MessageBox.warning( self,