Doubts related to subprocess.Popen()

Philip Semanchuk philip at semanchuk.com
Tue Jan 20 09:28:34 EST 2009


On Jan 20, 2009, at 9:19 AM, srinivasan srinivas wrote:

> Do parent process will have different file descriptor in it for each  
> subprocesses or paprent uses a single file descriptor for all?
> I really want to know creation of each subprocess will occupy an  
> entry in parents'file descriptor table. B'cos if i create more than  
> 200 subprocesses, i am getting 'Too many open files' error.

If you're on Unix, a command like lsof can be useful at a time like  
this.

lsof = "ls open files"

If you're on Linux, there's the /proc tree to investigate.





>
> ----- Original Message ----
> From: Mark Wooding <mdw at distorted.org.uk>
> To: python-list at python.org
> Sent: Tuesday, 20 January, 2009 6:16:17 PM
> Subject: Re: Doubts related to subprocess.Popen()
>
> srinivasan srinivas <sri_annauni at yahoo.co.in> writes:
>
>> Does subprocess.Popen() count a new open file for each suprocess? I
>> mean does it occupy an entry in file descriptor table of parent
>> process?  If so, wat is each file descriptor connected to?
>
> On Unix, subprocess.Popen will use up a file descriptor in the parent
> for each use of subprocess.PIPE.  The descriptor in question is one  
> end
> of a pipe; the child process holds the other end.
>
> I guess the situation is similar on Windows, but I don't know for  
> sure.
>
> -- [mdw]
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
>
>      Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
> --
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list