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


Groups > comp.lang.python > #52419

Re: Am I not seeing the Error?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <zachary.ware@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:not': 0.03; 'syntax': 0.04; 'continuation': 0.07; 'skip:\\ 20': 0.07; 'subject:Error': 0.07; "'')": 0.09; '[0]': 0.09; '__name__': 0.09; 'arguments': 0.09; 'collier': 0.09; 'constructor': 0.09; 'line:': 0.09; 'separating': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'suggest': 0.14; "'');": 0.16; "'__main__':": 0.16; 'callable': 0.16; 'etc.),': 0.16; 'semi-colons': 0.16; 'substitute': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'trying': 0.19; 'aug': 0.22; 'rules': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'mon,': 0.24; 'cc:2**0': 0.24; 'equivalent': 0.26; 'this:': 0.26; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'along': 0.30; 'lines': 0.31; 'implicit': 0.31; 'int,': 0.31; 'yes.': 0.31; 'skip:m 30': 0.32; 'option': 0.32; 'quite': 0.32; 'url:python': 0.33; 'call.': 0.33; 'subject:the': 0.34; "i'd": 0.34; 'johnson': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'skip:j 20': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'example,': 0.37; 'skip:m 40': 0.38; 'url:library': 0.38; 'list,': 0.38; 'little': 0.38; '12,': 0.39; 'how': 0.40; 'read': 0.60; 'url:3': 0.61; "you're": 0.61; 'first': 0.61; 'more': 0.64; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'within': 0.65; 'note:': 0.66; 'due': 0.66; 'between': 0.67; 'skip:m 50': 0.68; 'subject': 0.69; 'obvious': 0.74; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=fMoipMS063TdOfOjboSTdgXwr6bo2c3bTO9HKjW+H6w=; b=mC0HJ6ZFFOZappQmJEaJbfkH+Y624MfAAKDeoAgMYFQh+I0tNAklxc5O8dsCuG+85N n930alVg/eZQ3z2eNtDa/jw+TIn+gzyql2Wq7sFBUF05q/pWp0MX56bdiMAJTD2BEAhN nFtAQeKbIPekEzuXzjnJNNPs8S6tiL+OjaciVM0MZJh2vbWnEuQCaQDSYreOGwG1eLEb arlmfmdIViVhOW67OQDeFPFFFaHCFKouE7VR4P1gDlxNcyGM14doN+fkU3cOFEQm2em7 WQPWMNN58xpzFUlJYaDWOqXe3wnP7ZwnQC+waVgWyM/s7oWmGgA9bXb10ZpzpmYOSrjO ImgA==
X-Received by 10.205.24.6 with SMTP id rc6mr3733715bkb.66.1376321861251; Mon, 12 Aug 2013 08:37:41 -0700 (PDT)
MIME-Version 1.0
Sender zachary.ware@gmail.com
In-Reply-To <5208EB7E.6030907@Gmail.com>
References <5206F4AB.8050204@Gmail.com> <mailman.452.1376188442.1251.python-list@python.org> <roy-4A9C13.22431010082013@news.panix.com> <CAPTjJmoA+r3ABByjgMNC-23H0tB95r6S+d04T-KF-3xgbCNSOQ@mail.gmail.com> <5208D625.2000103@Gmail.com> <CAKJDb-P-TEqmGV45dbayaLdqh2nXE_FyLbd4dk7CPpcTsFWciQ@mail.gmail.com> <5208EB7E.6030907@Gmail.com>
From Zachary Ware <zachary.ware+pylist@gmail.com>
Date Mon, 12 Aug 2013 10:37:21 -0500
X-Google-Sender-Auth Fmn1iHWu2mDxooZtRGDLAfJYh7Q
Subject Re: Am I not seeing the Error?
To Devyn Collier Johnson <devyncjohnson@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc Python Mailing List <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>
Newsgroups comp.lang.python
Message-ID <mailman.502.1376322196.1251.python-list@python.org> (permalink)
Lines 72
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1376322196 news.xs4all.nl 15866 [2001:888:2000:d::a6]:36618
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52419

Show key headers only | View raw


On Mon, Aug 12, 2013 at 9:04 AM, Devyn Collier Johnson
<devyncjohnson@gmail.com> wrote:
>
> Zachary, are you, Ned, and Terry trying to say the syntax should be
>
> job = multiprocessing.Process(func1(), func2())
>
> not
>
> job = multiprocessing.Process(func1(); func2())
>

Basically, yes.  The first option there is equivalent to this:

    func_returns = (func1(), func2())

    job = multiprocessing.Process(*func_returns)

The second option is equivalent to this:

    job = multiprocessing.Process(func1()

    func2())

...which is actually several different syntax errors, depending on how
you look at it.  Semi-colon is only ever used in Python as a
substitute for \n-plus-some-spaces.  And, since in your original
example, your semi-colons are inside parenthesis, they really have no
effect at all due to implicit line continuation within parens.  So
your original line:

JOB_WRITEURGFILES =
multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID);
write2file(SENTEMPPATH, ''); write2file(INPUTMEM, ''));
JOB_WRITEURGFILES.start()

is really:

    JOB_WRITEURGFILES =
multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID)
write2file(SENTEMPPATH, '') write2file(INPUTMEM, ''))

    JOB_WRITEURGFILES.start()

It should be obvious now that the syntax error comes from not
separating the arguments to Process.

Trying to read between the lines a little here, I don't think you have
quite figured out how multiprocessing.Process works; that first option
above will only work if func1 returns None and func2 returns a
callable object and the second has no hope.  I think this is more
along the lines of what you're really after:

    def process_func():
        func1()
        func2()

    if __name__ == '__main__':
        job = multiprocessing.Process(target=process_func) # note: no
() after process_func!
        job.start()

I'd suggest giving the multiprocessing.Process docs [0] a good
read-through.  Keep in mind that Process is just a type like any other
(str, int, list, etc.), and calling its constructor is subject to the
same rules as any other function call.


-- 
Zach

[0] http://docs.python.org/3/library/multiprocessing#the-process-class

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


Thread

Re: Am I not seeing the Error? Chris Angelico <rosuav@gmail.com> - 2013-08-11 03:33 +0100
  Re: Am I not seeing the Error? Roy Smith <roy@panix.com> - 2013-08-10 22:43 -0400
    Re: Am I not seeing the Error? Chris Angelico <rosuav@gmail.com> - 2013-08-11 03:47 +0100
    Re: Am I not seeing the Error? Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-08-12 08:33 -0400
    Re: Am I not seeing the Error? Zachary Ware <zachary.ware+pylist@gmail.com> - 2013-08-12 08:20 -0500
    Re: Am I not seeing the Error? Ned Batchelder <ned@nedbatchelder.com> - 2013-08-12 10:01 -0400
    Re: Am I not seeing the Error? Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-08-12 10:04 -0400
      Re: Am I not seeing the Error? Roy Smith <roy@panix.com> - 2013-08-12 11:47 -0400
        Re: Am I not seeing the Error? Joel Goldstick <joel.goldstick@gmail.com> - 2013-08-12 12:56 -0400
        Re: Am I not seeing the Error? Chris Angelico <rosuav@gmail.com> - 2013-08-12 18:19 +0100
        Re: Am I not seeing the Error? Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-08-12 16:16 -0400
        Re: Am I not seeing the Error? Joel Goldstick <joel.goldstick@gmail.com> - 2013-08-12 16:34 -0400
        Re: Am I not seeing the Error? Ned Batchelder <ned@nedbatchelder.com> - 2013-08-12 16:35 -0400
        Re: Am I not seeing the Error? Joshua Landau <joshua@landau.ws> - 2013-08-13 09:19 +0100
          Re: Am I not seeing the Error? Steven D'Aprano <steve@pearwood.info> - 2013-08-13 08:50 +0000
            Re: Am I not seeing the Error? Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-08-13 06:31 -0400
            Re: Am I not seeing the Error? Robert Kern <robert.kern@gmail.com> - 2013-08-13 13:11 +0100
            Re: Am I not seeing the Error? Terry Reedy <tjreedy@udel.edu> - 2013-08-13 12:12 -0400
            Re: Am I not seeing the Error? Michael Torrie <torriem@gmail.com> - 2013-08-13 19:55 -0600
          Re: Am I not seeing the Error? Grant Edwards <invalid@invalid.invalid> - 2013-08-13 13:55 +0000
    Re: Am I not seeing the Error? Zachary Ware <zachary.ware+pylist@gmail.com> - 2013-08-12 10:37 -0500
    Re: Am I not seeing the Error? Zachary Ware <zachary.ware+pylist@gmail.com> - 2013-08-12 10:47 -0500
  Re: Am I not seeing the Error? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-11 08:28 +0000
    Re: Am I not seeing the Error? Joshua Landau <joshua@landau.ws> - 2013-08-11 11:18 +0100
    Re: Am I not seeing the Error? Roy Smith <roy@panix.com> - 2013-08-11 09:27 -0400

csiph-web