--- a/eric6/Utilities/BackgroundClient.py Fri Apr 02 11:59:41 2021 +0200 +++ b/eric6/Utilities/BackgroundClient.py Sat May 01 14:27:20 2021 +0200 @@ -16,10 +16,11 @@ import sys import time import traceback +import contextlib from zlib import adler32 -class BackgroundClient(object): +class BackgroundClient: """ Class implementing the main part of the background client. """ @@ -60,15 +61,15 @@ try: importedModule = __import__(module, globals(), locals(), [], 0) self.services[fn] = importedModule.initService() - try: + with contextlib.suppress(AttributeError): self.batchServices["batch_" + fn] = ( importedModule.initBatchService() ) - except AttributeError: - pass return 'ok' - except ImportError: - return 'Import Error' + except ImportError as err: + return 'Import Error: ' + str(err) + except Exception as err: + return str(err) def __send(self, fx, fn, data): """ @@ -124,9 +125,8 @@ data = b'' self.connection.setblocking(False) try: - data = self.connection.recv(length, socket.MSG_PEEK) - except OSError: - pass + with contextlib.suppress(OSError): + data = self.connection.recv(length, socket.MSG_PEEK) finally: self.connection.setblocking(True)