Re: how to get PID from subprocess library

2011-05-24 Thread Anssi Saari
TheSaint nob...@nowhere.net.no writes: self.handle= \ xmlrpclib.ServerProxy('http://localhost:%s/rpc' %int(self.numport)) Couldn't you just try to call something via this handle, like self.handle.aria2.getVersion()? If there's an error, then start aria2 as a daemon and try

Re: how to get PID from subprocess library

2011-05-24 Thread TheSaint
Anssi Saari wrote: Couldn't you just try to call something via this handle, like self.handle.aria2.getVersion()? If there's an error, then start aria2 as a daemon and try again. Very good, you're right. Furthermore I should avoid to call that function several times. I think to join it with

Re: how to get PID from subprocess library

2011-05-23 Thread TheSaint
GMail Felipe wrote: For the ps command, have you seen the psuti module? The link to it is: http://code.google.com/p/psutil/ You gave a brand new start :) I bit of additional program to include into the package ;) -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get PID from subprocess library

2011-05-22 Thread Kushal Kumaran
On Sat, May 21, 2011 at 6:20 PM, TheSaint nob...@nowhere.net.no wrote: Kushal Kumaran wrote: That's how it is able to give you the status.  So, if you are using getstatusoutput, you will have only one instance of your command running. My intent is to launch only one program instance, which

Re: how to get PID from subprocess library

2011-05-22 Thread TheSaint
Kushal Kumaran wrote: You could look for a way to make aria2c not become a daemon and use subprocess.Popen to start it. That gives you the PID and ways to see if the process is still running I see. It's a step that I've to get on my account. Unfortunately I'll have to study it some more.

Re: how to get PID from subprocess library

2011-05-22 Thread GMail Felipe
On 22/05/2011, at 10:41, TheSaint nob...@nowhere.net.no wrote: Kushal Kumaran wrote: You could look for a way to make aria2c not become a daemon and use subprocess.Popen to start it. That gives you the PID and ways to see if the process is still running I see. It's a step that I've to

Re: how to get PID from subprocess library

2011-05-21 Thread TheSaint
Kushal Kumaran wrote: That's how it is able to give you the status. So, if you are using getstatusoutput, you will have only one instance of your command running. My intent is to launch only one program instance, which will goes as daemon. To avoid a second call I'd like rather to use Python

Re: how to get PID from subprocess library

2011-05-20 Thread TheSaint
Miki Tebeka wrote: The best module for doing such things is subprocess. And the Popen object has a pid attribute I knew that, it's my fault that I'm not good to manage with popen. I found simplier to use subprocess.getstatusoutput. Maybe this function doesn't return the child pid, so I

Re: how to get PID from subprocess library

2011-05-20 Thread Kushal Kumaran
On Thu, May 19, 2011 at 9:32 PM, TheSaint nob...@nowhere.net.no wrote: hello, I'm using to launch a program by subprocess.getstatusoutput. I'd like to know whether I can get the program ID, in order to avoid another launch. For clarity sake, I'm calling aria2 (the download manager for linux)

how to get PID from subprocess library

2011-05-19 Thread TheSaint
hello, I'm using to launch a program by subprocess.getstatusoutput. I'd like to know whether I can get the program ID, in order to avoid another launch. For clarity sake, I'm calling aria2 (the download manager for linux) and I wouldn't like to call one more instance of it. So what will I use

Re: how to get PID from subprocess library

2011-05-19 Thread Miki Tebeka
The best module for doing such things is subprocess. And the Popen object has a pid attribute (http://docs.python.org/library/subprocess.html#subprocess.Popen.pid) -- http://mail.python.org/mailman/listinfo/python-list