diff --git a/src/omero/gateway/__init__.py b/src/omero/gateway/__init__.py index da42cb4b2..a955c2214 100644 --- a/src/omero/gateway/__init__.py +++ b/src/omero/gateway/__init__.py @@ -2092,8 +2092,14 @@ def _resetOmeroClient(self): logger.debug(self.ice_config) if self.c is not None: - self.c.__del__() - self.c = None + try: + if self.c.getSessionId() != self._sessionUuid: + self.c.__del__() + self.c = None + except omero.ClientError: # no session available + self.c.__del__() + self.c = None + pass if self.host is not None: if self.port is not None: