diff --git a/src/omero/gateway/__init__.py b/src/omero/gateway/__init__.py index 771666046..7cc91f92e 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: @@ -2145,17 +2151,14 @@ def connect(self, sUuid=None): logger.debug( "was connected, creating new omero.client") self._resetOmeroClient() - print("Client created") # timeout to allow this is $ omero config set # omero.sessions.timeout 3600000 s = self.c.joinSession(self._sessionUuid) s.detachOnDestroy() - print("Session joined") self.SERVICE_OPTS = self.createServiceOptsDict() logger.debug( 'Joined Session OK with Uuid: %s' % (self._sessionUuid,)) - print("Join %s:" % self._sessionUuid) self._was_join = True except Ice.SyscallException: # pragma: no cover raise