1

I have 10 python windows that are running a code. Every script has specific word in output (running instance1, running instance2,running instance3..)...

sometimes script crashes and [try: except:] method doesn't work on this.

So I need a way to loop trough open python windows and ask: does the any of python windows contain in their output word 'running instance1', or 'running instance2' and if it doesn't then 'do this'...

EDIT: Popen and subprocess can be used when you are calling a .py from another .py. I need something to read output of already running .py program. I need a way to connect to its output window over PID or name like python.exe.

Anyone?

2
  • 2
    Possible duplicate of python, subprocess: reading output from subprocess Commented Mar 2, 2017 at 13:21
  • 1
    Wouldn't it be better to fix the exception handling [try: except:] and not have another layer to make up for it? Commented Mar 2, 2017 at 14:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.