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 | jjcogliati |
|---|---|
| Recipients | jjcogliati |
| Date | 2008年03月24日.20:59:06 |
| SpamBayes Score | 0.42825365 |
| Marked as misclassified | No |
| Message-id | <1206392349.51.0.854683862843.issue2475@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
I was trying to use subprocess to run multiple processes, and then wait until one was finished. I was using poll() to do this and created the following test case: #BEGIN import subprocess,os procs = [subprocess.Popen(["sleep",str(x)]) for x in range(1,11)] while len(procs) > 0: os.wait() print [(p.pid,p.poll()) for p in procs] procs = [p for p in procs if p.poll() == None] #END I would have expected that as this program was run, it would remove the processes that finished from the procs list, but instead, they stay in it and I got the following output: #Output [(7426, None), (7427, None), (7428, None), (7429, None), (7430, None), (7431, None), (7432, None), (7433, None), (7434, None), (7435, None)] #above line repeats 8 more times [(7426, None), (7427, None), (7428, None), (7429, None), (7430, None), (7431, None), (7432, None), (7433, None), (7434, None), (7435, None)] Traceback (most recent call last): File "./test_poll.py", line 9, in <module> os.wait() OSError: [Errno 10] No child processes #End output Basically, even for finished processes, poll returns None. Version of python used: Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26) [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2 Relevant documentation in Library reference manual 17.1.2 poll( ) ... Returns returncode attribute. ... A None value indicates that the process hasn't terminated yet. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008年03月24日 20:59:09 | jjcogliati | set | spambayes_score: 0.428254 -> 0.42825365 recipients: + jjcogliati |
| 2008年03月24日 20:59:09 | jjcogliati | set | spambayes_score: 0.428254 -> 0.428254 messageid: <1206392349.51.0.854683862843.issue2475@psf.upfronthosting.co.za> |
| 2008年03月24日 20:59:08 | jjcogliati | link | issue2475 messages |
| 2008年03月24日 20:59:07 | jjcogliati | create | |