0
I am using a python code, not mine, that runs for days or even weeks. It might have some bugs left, so it might crash once in a while. But I dont want to check it every couple of hours. I know that the python process(es) do return codes !=0 if something happens.
But is it possible to catch that from outside of the processes? If yes, I would like to do that, so I can send an Email to myself if something happens.
Thx.
Could you please elaborate? If I am running a.py, which takes ages, I run then b.py which is able to check if a.py returns error messages? Because I don't want to mess around in a.py – Pythoneer – 2018-09-20T16:35:30.027
Your question and comment are unclear. How do you pass any error to
b.py
? In a run parameter? in an environment variable? in a file? I can't elaborate my answer until you elaborate your question. If you will always runb.py
, then theif
in my answer is unnecessary: it could be as simple asa.py; b.py $?
, whereb.py
is passed the completion code froma.py
in its first parameter. – AFH – 2018-09-20T16:55:41.670No, thats the point. I start screen, start python a.py, and then let it run its course. Thats all I do. if a.py crashes, it will be seen in the screen, because it will print stuff like returned 1 ... and I would somehow like to catch this... – Pythoneer – 2018-09-20T18:00:32.103
I assumed that
a.py
callssys.exit()
in order to return the completion status. If it doesn't, you'll have a lot of difficulty in reading strings from a window: although you don't want to modifya.py
, this is probably the easiest answer. – AFH – 2018-09-20T18:33:55.120