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?

mklement0
  • 382,024
  • 64
  • 607
  • 775
Marine Fighter
  • 383
  • 2
  • 7
  • 2
    Possible duplicate of [python, subprocess: reading output from subprocess](http://stackoverflow.com/questions/3804727/python-subprocess-reading-output-from-subprocess) – Jean-François Fabre Mar 02 '17 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? – lit Mar 02 '17 at 14:38

0 Answers0