On Fri, Aug 8, 2014 at 5:17 PM, Rustom Mody <rustompm...@gmail.com> wrote: >> But with Roy's suggestion, testing for the existence of os.fork is not >> sufficient, because it will exist even on platforms where fork doesn't >> exist. So testing that os.fork exists is not sufficient to tell whether or >> not you can actually fork. > > Windows: > > Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] > on win32 > Type "copyright", "credits" or "license()" for more information. >>>> import os >>>> os.fork > > Traceback (most recent call last): > File "<pyshell#1>", line 1, in <module> > os.fork > AttributeError: 'module' object has no attribute 'fork' > > > Linux: > > $ python > Python 2.7.8 (default, Jul 4 2014, 13:08:34) > [GCC 4.9.0] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import os >>>> os.fork > <built-in function fork> >>>> > > > So yes, I continue to miss something...
I think the bit you're missing is the "with Roy's suggestion" bit, at which os.fork() would be callable and would raise a different error. It's of course possible for fork() to fail (no memory, ulimit hit, etc etc etc), but I would expect that the presence of os.fork should correspond perfectly to the API's availability (at least as detected by Python's compilation testing). ChrisA -- https://mail.python.org/mailman/listinfo/python-list