Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!news.cgarbs.de!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '2.7': 0.05; 'python?': 0.07; 'python': 0.07; 'url:pypi': 0.09; 'okay': 0.09; 'files.': 0.10; 'scripts': 0.10; 'written': 0.12; 'am,': 0.14; 'wrote:': 0.14; 'with?': 0.16; 'versions': 0.18; 'this?': 0.18; 'tue,': 0.20; 'seems': 0.21; 'code': 0.22; 'header:In-Reply-To:1': 0.22; 'trying': 0.23; 'subject:code': 0.23; 'example': 0.24; 'version': 0.25; 'instead': 0.26; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'class.': 0.29; 'yet': 0.30; '17,': 0.31; 'worker': 0.31; 'import': 0.32; 'called': 0.32; 'to:addr:python- list': 0.32; 'things': 0.33; 'lines': 0.34; 'using': 0.34; 'actually': 0.34; 'there': 0.35; 'flag': 0.35; 'doing': 0.36; 'processing': 0.37; 'some': 0.37; 'url:python': 0.37; 'run': 0.37; 'eric': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'url:org': 0.38; 'anything': 0.38; 'set': 0.39; 'to:addr:python.org': 0.39; 'except': 0.39; 'would': 0.40; 'best': 0.60; 'back': 0.61; '2011': 0.62; 'below': 0.63; 'manager.': 0.73; 'received:129': 0.84 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 17 May 2011 08:49:02 -0700 Subject: Re: portable multiprocessing code From: Benjamin Kaplan To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Junkmail-Status: score=10/49, host=mpv1.tis.cwru.edu X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A020209.4DD298F2.023B,ss=1,fgs=0, ip=74.125.82.42, so=2010-12-23 16:51:53, dmn=2009-09-10 00:05:08, mode=single engine X-Junkmail-IWF: false X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305647357 news.xs4all.nl 49179 [::ffff:82.94.164.166]:41740 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5571 On Tue, May 17, 2011 at 8:14 AM, Eric Frederich wrote: > I have written some code using Python 2.7 but I'd like these scripts > to be able to run on Red Hat 5's 2.4.3 version of Python which doesn't > have multiprocessing. > I can try to import multiprocessing and set a flag as to whether it is > available. =A0Then I can create a Queue.Queue instead of a > multiprocessing.Queue for the arg_queue and result_queue. > Without actually trying this yet it seems like things would work okay > except for the Worker class. =A0It seems I can conditionally replace > multiprocessing.Queue with Queue.Queue, but is there anything to > replace multiprocessing.Process with? > > Are there any best practices for doing something like this? > Below is a dumb example that just counts lines in files. > What would be the best way to make this runnable in older (2.4.3) > versions of Python? > http://pypi.python.org/pypi/multiprocessing Also, you may be able to find the processing package (what multiprocessing was called back when it was 3rd party) in your package manager.