Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'pypi': 0.04; 'responding': 0.04; 'ubuntu': 0.04; 'interpreter': 0.07; 'python': 0.07; 'advance.': 0.09; '>>>>': 0.09; '[0,': 0.09; 'subject:broken': 0.09; 'pm,': 0.11; 'described': 0.14; 'wrote:': 0.14; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '[gcc': 0.16; 'jumps': 0.16; 'linux2': 0.16; 'python2.6': 0.16; 'tue,': 0.20; 'header:In-Reply-To:1': 0.22; 'cases': 0.25; 'says': 0.25; 'received:209.85.220': 0.26; 'tried': 0.27; 'message- id:@mail.gmail.com': 0.28; 'subject:?': 0.29; 'anyone': 0.31; 'import': 0.32; 'to:addr:python-list': 0.32; "i've": 0.33; "isn't": 0.34; 'actually': 0.34; 'correctly': 0.35; 'print': 0.35; 'running': 0.36; 'case': 0.37; 'received:209.85': 0.37; 'issue': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'how': 0.39; 'behavior': 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'mar': 0.64; "(i've": 0.84; 'hints?': 0.84; 'imap': 0.84; 'zhang': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=zC4lk8jVI6tNY++8Eu4Cb7ja0PxWf4+0tCfwGNkkJyY=; b=Uc4g+uVAr/lYiM5WBkABAmToYYPnKz/gYXLXpXM2cZugZw1lgaiXRqms/Yj6Nz+TAg o/Hnu6HpzMcFQhJCMbg3ToGFb7ESbBk26hZ733uWroXxcJTJOAUU7p/t9zhOcBy22cAu eaiOqu+I7wPETUsypLx2IPapCva05Q7GT2YDM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=e+bKz+jcbv2csEbGiclw3PgkE1LbnkYSRgW5jWcRGrJOWNJaBIa0X1AHi7s0Km995P v8oLsJ7LrDQZuqS8OfHfBJogFjsQrXyy2S8npVWNX1vWZYvawtB4tPKDnJcRlbySxFEY 6NpIkZV2D0OZyffDRKSJpWKvqXIREz7ouyVt0= MIME-Version: 1.0 In-Reply-To: References: From: Yang Zhang Date: Tue, 29 Mar 2011 18:51:28 -0700 Subject: Re: multiprocessing Pool.imap broken? To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 33 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1301449911 news.xs4all.nl 41113 [::ffff:82.94.164.166]:50027 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2207 On Tue, Mar 29, 2011 at 6:44 PM, Yang Zhang wrote: > I've tried both the multiprocessing included in the python2.6 Ubuntu > package (__version__ says 0.70a1) and the latest from PyPI (2.6.2.1). > In both cases I don't know how to use imap correctly - it causes the > entire interpreter to stop responding to ctrl-C's. =A0Any hints? =A0Thank= s > in advance. > > $ python > Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) > [GCC 4.4.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import multiprocessing as mp >>>> mp.Pool(1).map(abs, range(3)) > [0, 1, 2] >>>> list(mp.Pool(1).imap(abs, range(3))) > ^C^C^C^C^\Quit > In case anyone jumps on this, this isn't an issue with running from the con= sole: $ cat /tmp/go3.py import multiprocessing as mp print mp.Pool(1).map(abs, range(3)) print list(mp.Pool(1).imap(abs, range(3))) $ python /tmp/go3.py [0, 1, 2] ^C^C^C^C^C^\Quit (I've actually never seen the behavior described in the corresponding Note at the top of the multiprocessing documentation.)