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.

Title: OSError: [Errno 10] No child processes
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6, Python 2.5
Status: closed Resolution: duplicate
Dependencies: Superseder: race condition in subprocess module
View: 1731717
Assigned To: Nosy List: amaury.forgeotdarc, flox, yonas
Priority: normal Keywords:

Created on 2009-05-27 08:12 by yonas, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
mylib.c yonas, 2009-05-27 08:12
main.c yonas, 2009-05-27 08:12 yonas, 2009-05-27 16:50
Messages (10)
msg88407 - (view) Author: Yonas (yonas) Date: 2009-05-27 08:12
I always get a subprocess error when using embedded Python 2.6.2:

File "/usr/lib/python2.6/", line 1123, in wait:     pid,
sts = os.waitpid(, 0): OSError: [Errno 10] No child processes

Sample library and main files attached.
msg88408 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-05-27 08:36
The content of would be useful as well.
msg88422 - (view) Author: Yonas (yonas) Date: 2009-05-27 16:50
The test doesn't fail when run directly from ./main, but it fails when
run from exim4 mail server. 

exim will dlopen() mylib and run local_scan().

Besides using Popen, I haven't had any problems.
msg88423 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-05-27 17:28
your program works for me.
How did you compile the files? I used the following commands:

$ gcc -fPIC -I/usr/local/include/python2.6/ mylib.c -L /usr/local/lib
-lpython2.6 --shared -o

$ gcc main.c -ldl 

$ ./a.out

(after removing all references to exim4, which is not really used)
msg88424 - (view) Author: Yonas (yonas) Date: 2009-05-27 17:44
Thanks for testing, it works when running ./main, but not when run
through exim.
msg88426 - (view) Author: Yonas (yonas) Date: 2009-05-27 18:17
I didn't find anything unusual about how exim uses dlopen, but if you
want to see the code, it's here:

Line 166 is the actual call.

Again, no problems except with Python's Popen().
msg88433 - (view) Author: Yonas (yonas) Date: 2009-05-27 19:37
Could this be a permissions issue? I have no idea how permissions would
effect it, though...

root@yonas-laptop:/usr/lib/exim4/local_scan# ls -la /usr/sbin/exim4
-rwsr-xr-x 1 root root 824440 2009-02-11 08:53 /usr/sbin/exim4
msg88440 - (view) Author: Yonas (yonas) Date: 2009-05-27 20:06
os.system() works:

os.system("echo `date` >> /tmp/myfile")

root@yonas-laptop:/usr/lib/exim4/local_scan# cat /tmp/myfile 
Wed May 27 16:04:54 EDT 2009
Wed May 27 16:04:54 EDT 2009
msg88442 - (view) Author: Yonas (yonas) Date: 2009-05-27 20:52
Here's another test, taken from the docs:

This is slightly better than Popen because the program executes and
shows output, but worse than os.system(), because it still shows the error:

            retcode = call("echo" + " \"hello world\"", shell=True)
            if retcode < 0:
                print >>sys.stderr, "Child was terminated by signal",
                print >>sys.stderr, "Child was terminated by signal",
                print >>sys.stderr, "Child returned", retcode
        except OSError, e:
            print >>sys.stderr, "Execution failed:", e

hello world
Execution failed: [Errno 10] No child processes
msg100431 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-03-04 22:58
Another duplicate of #1731717
Date User Action Args
2022-04-11 14:56:49adminsetgithub: 50372
2010-03-04 22:58:08floxsetstatus: open -> closed
priority: normal
superseder: race condition in subprocess module

nosy: + flox
messages: + msg100431
resolution: duplicate
2009-05-27 20:59:53yonassetversions: + Python 2.5, Python 3.0
2009-05-27 20:52:46yonassetmessages: + msg88442
2009-05-27 20:06:39yonassetmessages: + msg88440
2009-05-27 19:37:19yonassetmessages: + msg88433
2009-05-27 18:17:40yonassetmessages: + msg88426
2009-05-27 17:44:55yonassetmessages: + msg88424
2009-05-27 17:28:40amaury.forgeotdarcsetmessages: + msg88423
2009-05-27 16:50:50yonassetfiles: +

messages: + msg88422
2009-05-27 12:27:11r.david.murraysettype: crash -> behavior
components: + Library (Lib)
2009-05-27 08:36:58amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg88408
2009-05-27 08:13:32yonassettype: crash
2009-05-27 08:13:00yonassettitle: [Errno 10] No child processes -> OSError: [Errno 10] No child processes
2009-05-27 08:12:25yonassetfiles: + main.c
2009-05-27 08:12:14yonascreate