Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'python.': 0.02; '22,': 0.09; 'bytes,': 0.09; 'occasionally': 0.09; 'oh,': 0.09; 'subject:using': 0.09; 'beam': 0.16; 'bytes).': 0.16; 'chunks': 0.16; 'exceptions;': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'processes.': 0.16; 'side.': 0.16; 'subject:skip:m 10': 0.16; 'subject:when': 0.16; 'such,': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'module': 0.19; 'stack': 0.19; 'saying': 0.22; 'separate': 0.22; 'bytes': 0.24; '(or': 0.24; 'equivalent': 0.26; 'references': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'leave': 0.29; 'message- id:@mail.gmail.com': 0.30; 'fri,': 0.33; 'problem': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'instances': 0.36; 'method': 0.36; 'subject:?': 0.36; 'operating': 0.37; 'two': 0.37; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'moving': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'john': 0.61; 'simple': 0.61; 'back': 0.62; 'hearing': 0.63; 'information': 0.63; 'such': 0.63; 'between': 0.67; 'sound': 0.68; 'facilities': 0.69; 'other.': 0.75; 'transfer': 0.82; 'pickled': 0.84; 'streams': 0.84; 'imagine': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=1qq9etl7HO5tKt7F9K4SbxFdKV7mV/JykfKnNi3yRVs=; b=gd9CK+/AJTe2Eb0R8/EsVggEZCVoaWnChvLJIoLttpEHoxktFbQPvZhXQugf6yCx1D bhmW83TnItw6W/ykD+lw+hFXzJ0dEvJyy/LrHklxrMQNQe4MTxy1elGIFKaFjBe8cXW2 gckfDFLn+TTztjCXA7Y8qwEdVr2XwjNbjy3N/RdCRnrpNMxrlQcALpuOkHfa+XMBU3YZ njOxht3wc99zoy1cvmpIeXrsAUhQ4OHaR3Fxv4PhTsp+ZKSb1kH5CJWZXedAXKJP+A+U WiojMv67jE500nYFHf4GtH1O7f3Kz54yhHtX7y2Uwmy8ONxgz4kDvQvN5dnDX9PQhwIx tLsg== MIME-Version: 1.0 X-Received: by 10.68.232.232 with SMTP id tr8mr280365pbc.184.1385094245553; Thu, 21 Nov 2013 20:24:05 -0800 (PST) In-Reply-To: <081af7df-2330-4b8b-abbf-4707edfcc17a@googlegroups.com> References: <081af7df-2330-4b8b-abbf-4707edfcc17a@googlegroups.com> Date: Fri, 22 Nov 2013 15:24:05 +1100 Subject: Re: Traceback when using multiprocessing, less than helpful? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385094254 news.xs4all.nl 15939 [2001:888:2000:d::a6]:40543 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60200 On Fri, Nov 22, 2013 at 2:57 PM, John Ladasky wrote: > or, for that matter, why data needs to be pickled to pass it between processes. Oh, that part's easy. Let's leave the multiprocessing module out of it for the moment; imagine you spin up two completely separate instances of Python. Create some object in one of them; now, transfer it to the other. How are you going to do it? Ultimately, the operating system isn't going to give you facilities for moving complex objects around - what you almost exclusively get is streams of bytes (or occasionally messaged chunks with lengths, but still of bytes). Pickling is one method of turning an object into a stream of bytes, in such a way that it can be turned back into an equivalent object on the other side. And therein is the problem with exceptions; since the traceback includes references to stack frames and such, it's not as simple as saying "Two to beam up" and hearing the classic sound effect - somehow you need to transfer all the appropriate information across processes. ChrisA