Posts: 707
Joined: Jul 2004
Reputation:
6
is there any way to know from, let say, script 'father', if a 'child' script is running ?
something like :
isrunning(path+ "pythonscript.py") :: return true if pythonscript.py is actually running (shown with (running...) after the script name)
thanks in advance for any help
Posts: 707
Joined: Jul 2004
Reputation:
6
cheers !
i'm not sure if it is really what i need...
let me explain a bit more:
the script i'm working on needs another script running in background.
my script is somethin that connect to a http url to get a video stream and save it on hdd.
the script running in background is a proxy, that just catch the http request (from my script), proxy it to a server using rtsp, and sending back on http the video stream.
so actually, i :
1- start the proxy script running in a loop waiting for http connection
2- start my script to select a video channel and send the http request for video stream
so in my mind, both script are running separetely, no import from one in the other... i'm not very clever in python, but i do my best, so importing a module in another one is pretty tricky as i'm never really sure how this should be done...
so can you confirm me, that if a script is shown as (running...) inside scripts screen, it will appear in 'sys.modules' ?
anyway, i will have some test using your idea and let you know what are my results
Posts: 3,909
Joined: Dec 2004
Reputation:
20
Nuka1195
Skilled Python Coder
Posts: 3,909
if you create a "dummy.py" (just an empty text file) and import that in child script. (import dummy) it will show up in sys.modules list in the paraent if the script is still running.
but maybe check one of the os.spawn*(). this maybe what you want?
Posts: 707
Joined: Jul 2004
Reputation:
6
Hi !
I know it has been a long time since this question.
I tried the import of a dummy library and it works just fine. Not sure it is a very clean way to do it but it works.