0

I am developing a GUI interface for a Python module (running in CLI), that when executed was the output bellow:

Progress:  50%|███████████████                | 45/45 [time,  info]
Message 1
Message 2
Progress: 100%|███████████████████████████████| 45/45 [time,  info]
Finished!

I intend to execute this as a subprocess and get the output, parse the perceptual to a process bar and the "Messages" to a log.

How I do that? Is it possible with subprocess get the output of a CLI software periodically (or each new entry) without show the terminal?

To execute it now, I am using subprocess.call('shell command', shell=True). So it is really a shell command (that at the end load and run a python module), but this give the output in the terminal.

hildogjr
  • 754
  • 2
  • 6
  • 17
  • Are you familiar with how to write to a file in python? Check out the docs for Input and Output: https://docs.python.org/2/tutorial/inputoutput.html – JacobIRR Jan 17 '18 at 18:16
  • Yes, write a file, is almost the same in each language. But how this could help me? I intend to not change the CLI software (I can, but prefer also keep it as a possible interface). Just intend to run the GUI as a layer between the ~not experient~ user and the CLI. – hildogjr Jan 17 '18 at 18:20
  • Something as https://stackoverflow.com/questions/4856583/how-do-i-pipe-a-subprocess-call-to-a-text-file, I realize. But how to process this output file to update the GUI, by a timer? (appear not pythonized) – hildogjr Jan 17 '18 at 18:35

0 Answers0