0

My program is written in Python and runs on Ubuntu. I need to run from Python a long process, written in C++, catch an on going messages and print it in a GUI text box.

Lets say I have function with a reference to GUI window which receives strings:

def print_log(self, message):
    self.log_method_ref(message)

I run an external process (written in C++) by:

cmd = f'decode_data --input /home/input_data --output /home/result_folder'
exit_code = os.system(cmd)
if exit_code != 0:
    err_msg = f"f'decode_data finished with an error! Exit code {exit_code}"

The process is very long, it might take from 1 second to 30 minutes, depending on amount of data provided as input. When I run the program without GUI I get all messages from a process printed in terminal window or Pycharm console. But I can't catch these messages and print it in a GUI window when the process is running, all I can get (using PIPE) is the whole log from the process when it finishes.

Dmitry Kezin
  • 105
  • 1
  • 3
  • 10

0 Answers0