Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37054

Re: Question related to multiprocessing.Process

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <iwarobots@gmail.com>
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; 'subject:Question': 0.07; 'wang': 0.07; 'python': 0.09; 'idea?': 0.09; 'imports': 0.09; 'subject:related': 0.09; 'terminate.': 0.09; 'to:addr:comp.lang.python': 0.09; 'way:': 0.09; 'cc:addr:python- list': 0.10; 'def': 0.10; 'advance.': 0.15; 'sat,': 0.15; 'instantiates': 0.16; 'run(self):': 0.16; 'win7': 0.16; 'wrote:': 0.17; 'module,': 0.17; 'jan': 0.18; 'windows': 0.19; 'module': 0.19; 'import': 0.21; 'skip:_ 20': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'command': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'thanks!': 0.26; 'received:209.85.212': 0.28; 'chris': 0.28; 'routine': 0.29; 'starts': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; "i'm": 0.29; 'print': 0.32; 'code:': 0.33; 'hi,': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'should': 0.36; 'skip:p 20': 0.36; 'keeps': 0.37; 'does': 0.37; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'think': 0.40; 'your': 0.60; "you'll": 0.62; 'protect': 0.69; 'prompt': 0.78; '2013': 0.84; 'repeat.': 0.84; 'rinse': 0.84; 'works!': 0.84
X-Received by 10.182.220.10 with SMTP id ps10mr379970obc.33.1358573615537; Fri, 18 Jan 2013 21:33:35 -0800 (PST)
Newsgroups comp.lang.python
Date Fri, 18 Jan 2013 21:33:35 -0800 (PST)
In-Reply-To <mailman.665.1358571909.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=124.79.196.189; posting-account=Li8yggkAAAAn1vIAb9dmn7qk39nBJvjm
References <6816f48f-753f-4ae3-be79-3b16bd83e6f2@googlegroups.com> <mailman.665.1358571909.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 124.79.196.189
MIME-Version 1.0
Subject Re: Question related to multiprocessing.Process
From Cen Wang <iwarobots@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.668.1358573617.2939.python-list@python.org> (permalink)
Lines 58
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358573617 news.xs4all.nl 6855 [2001:888:2000:d::a6]:36998
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:37054

Show key headers only | View raw


Thanks! It now works!
On Saturday, 19 January 2013 13:05:07 UTC+8, Chris Angelico  wrote:
> On Sat, Jan 19, 2013 at 3:50 PM, Cen Wang <iwarobots@gmail.com> wrote:
> 
> > Hi, when I use multiprocessing.Process in this way:
> 
> >
> 
> > from multiprocessing import Process
> 
> >
> 
> > class MyProcess(Process):
> 
> >
> 
> >     def __init__(self):
> 
> >         Process.__init__(self)
> 
> >
> 
> >     def run(self):
> 
> >         print 'x'
> 
> >
> 
> > p = MyProcess()
> 
> > p.start()
> 
> >
> 
> > It just keeps printing 'x' on my command prompt and does not end. But I think MyProcess should print an 'x' and then terminate. I don't why this is happening. I'm using Win7 64 bit, Python 2.7.3. Any idea? Thanks in advance.
> 
> 
> 
> Multiprocessing on Windows requires that your module be importable. So
> 
> it imports your main module, which instantiates another MyProcess,
> 
> starts it, rinse and repeat. You'll need to protect your main routine
> 
> code:
> 
> 
> 
> if __name__=="__main__":
> 
>     p = MyProcess()
> 
>     p.start()
> 
> 
> 
> ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Question related to multiprocessing.Process Cen Wang <iwarobots@gmail.com> - 2013-01-18 20:50 -0800
  Re: Question related to multiprocessing.Process Chris Angelico <rosuav@gmail.com> - 2013-01-19 16:05 +1100
    Re: Question related to multiprocessing.Process Cen Wang <iwarobots@gmail.com> - 2013-01-18 21:33 -0800
    Re: Question related to multiprocessing.Process Cen Wang <iwarobots@gmail.com> - 2013-01-18 21:33 -0800
  Re: Question related to multiprocessing.Process Terry Reedy <tjreedy@udel.edu> - 2013-01-19 06:27 -0500

csiph-web