This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients d_kagedal, gregory.p.smith, vstinner, yorick
Date 2008-09-22.16:34:03
SpamBayes Score 3.1322181e-06
Marked as misclassified No
Message-id <1222101245.36.0.183544146865.issue3392@psf.upfronthosting.co.za>
In-reply-to
Content
I don't understand the problem. If you open a lot of files, the open() 
loop will stop an exception (IOError: too many open files), and so 
subprocess is not used.

If I open <limit>-1 files, subprocess._get_handles() will fail on 
os.pipe().

If I open <limit>-4 files, the script doesn't fail.

I'm using Linux. Here is my script:
---
# open <limit>-4 files
import subprocess
files = []
while 1:
    try:
        newfile = open("/etc/passwd")
    except IOError, err:
        print "ERR: %s" % err
        break
    files.append(newfile)

# use -3 to get an error
for file in files[-4:]:
    print "close"
    file.close()

# success
subprocess.Popen(["date"], stdout=subprocess.PIPE).communicate()
---
History
Date User Action Args
2008-09-22 16:34:05vstinnersetrecipients: + vstinner, gregory.p.smith, yorick, d_kagedal
2008-09-22 16:34:05vstinnersetmessageid: <1222101245.36.0.183544146865.issue3392@psf.upfronthosting.co.za>
2008-09-22 16:34:04vstinnerlinkissue3392 messages
2008-09-22 16:34:03vstinnercreate