@@ -333,10 +333,8 @@ def sendExpression(self, command: str, parsed: bool = True):
333333 pass
334334 attempts += 1
335335 if attempts >= 50 :
336- self ._omc_filehandle_log .seek (0 )
337- log = self ._omc_filehandle_log .read ()
338- self ._omc_filehandle_log .close ()
339- raise OMCSessionException (f"No connection with OMC (timeout={ self ._timeout } ). Log-file says: \n { log } " )
336+ raise OMCSessionException (f"No connection with OMC (timeout={ self ._timeout } ). "
337+ f"Log-file says: \n { self .omc_process .get_log ()} " )
340338 time .sleep (self ._timeout / 50.0 )
341339 if command == "quit()" :
342340 self .omc_zmq .close ()
@@ -448,6 +446,17 @@ def get_port(self) -> str:
448446 raise OMCSessionException (f"Invalid port to connect to OMC process: { self ._omc_port } " )
449447 return self ._omc_port
450448
449+ def get_log (self ) -> str :
450+ # self._omc_filehandle_log.seek(0)
451+ # log = self._omc_filehandle_log.read()
452+ # self._omc_filehandle_log.close()
453+
454+ # TODO: handle log; close log at this point? what about the process, etc?
455+
456+ log = 'unknown'
457+
458+ return log
459+
451460
452461class OMCProcessDummy (OMCProcess ):
453462
@@ -514,6 +523,17 @@ def __del__(self):
514523 self ._omc_process .kill ()
515524 self ._omc_process .wait ()
516525
526+ def get_log (self ) -> str :
527+ if self ._omc_filehandle_log is not None :
528+ self ._omc_filehandle_log .seek (0 )
529+ log = self ._omc_filehandle_log .read ()
530+ # TODO: close file here or keep it open?
531+ # self._omc_filehandle_log.close()
532+ else :
533+ log = '(not available)'
534+
535+ return log
536+
517537 @staticmethod
518538 def _filename_port (current_user : str , random_str : str ) -> str :
519539 if sys .platform != 'win32' :
0 commit comments