Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75869
| References | (2 earlier) <roy-496ACC.07490507082014@news.panix.com> <53e3afd9$0$29970$c3e8da3$5496439d@news.astraweb.com> <f865db66-8cb8-4796-a8f0-bedfb2ef5079@googlegroups.com> <53e464a3$0$30003$c3e8da3$5496439d@news.astraweb.com> <ca10fd68-16c7-45dc-b281-8a84e83d0b23@googlegroups.com> |
|---|---|
| Date | 2014-08-08 17:32 +1000 |
| Subject | Re: AttributeError: 'module' object has no attribute 'fork' |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12741.1407483183.18130.python-list@python.org> (permalink) |
On Fri, Aug 8, 2014 at 5:17 PM, Rustom Mody <rustompmody@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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
AttributeError: 'module' object has no attribute 'fork' Satish ML <satishmlwizpro@gmail.com> - 2014-08-06 23:44 -0700
Re: AttributeError: 'module' object has no attribute 'fork' Peter Otten <__peter__@web.de> - 2014-08-07 09:00 +0200
Re: AttributeError: 'module' object has no attribute 'fork' Roy Smith <roy@panix.com> - 2014-08-07 07:49 -0400
Re: AttributeError: 'module' object has no attribute 'fork' Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-08 02:56 +1000
Re: AttributeError: 'module' object has no attribute 'fork' Rustom Mody <rustompmody@gmail.com> - 2014-08-07 22:19 -0700
Re: AttributeError: 'module' object has no attribute 'fork' Rustom Mody <rustompmody@gmail.com> - 2014-08-07 22:35 -0700
Re: AttributeError: 'module' object has no attribute 'fork' Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-08 15:48 +1000
Re: AttributeError: 'module' object has no attribute 'fork' Rustom Mody <rustompmody@gmail.com> - 2014-08-08 00:17 -0700
Re: AttributeError: 'module' object has no attribute 'fork' Chris Angelico <rosuav@gmail.com> - 2014-08-08 17:32 +1000
csiph-web