--- a/eric6/DebugClients/Python/DebugClientBase.py Tue Oct 13 19:02:26 2020 +0200 +++ b/eric6/DebugClients/Python/DebugClientBase.py Wed Oct 14 17:50:39 2020 +0200 @@ -220,11 +220,10 @@ else: default = 'utf-8' try: - f = open(filename, 'rb') - # read the first and second line - text = f.readline() - text = "{0}{1}".format(text, f.readline()) - f.close() + with open(filename, 'rb') as f: + # read the first and second line + text = f.readline() + text = "{0}{1}".format(text, f.readline()) except IOError: self.__coding = default return