here is my problem: I need to execute a cmd command from python, the command is not something that executes fast, it will be running for a longer period of time. What I need is a way to #1 execute the command and #2 get the continuous output of that command.
Example of the output:
some text... (then about half a minute wait)
some other text... (waiting for some time)
more text...
You get the idea, the output comes about every 30 seconds. I need to catch all of the outputs and do something with them. Is there a way to do this?
I know I can execute the command with os.system('command') but i'm struggling to find a way to read the output!
subprocessmodule. It's a bit of a steep learning curve, but doing what you want has more variations than you expect.os.system()has been deprecated for nearly 20 years (since Python 2.4), one of the reasons being the problem you have encountered.