Message73585
| 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:05 | vstinner | set | recipients:
+ vstinner, gregory.p.smith, yorick, d_kagedal |
| 2008年09月22日 16:34:05 | vstinner | set | messageid: <1222101245.36.0.183544146865.issue3392@psf.upfronthosting.co.za> |
| 2008年09月22日 16:34:04 | vstinner | link | issue3392 messages |
| 2008年09月22日 16:34:03 | vstinner | create |
|