Deutsch English Français Italiano |
<mailman.29.1725356105.2917.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.misty.com!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail From: marc nicole <mk1853387@gmail.com> Newsgroups: comp.lang.python Subject: Re: [Tutor] Getting a Process.start() error pickle.PicklingError: Can't pickle <type 'module'>: it's not found as __builtin__.module with Python 2.7 Date: Tue, 3 Sep 2024 11:34:53 +0200 Lines: 109 Message-ID: <mailman.29.1725356105.2917.python-list@python.org> References: <CAGJtH9Tw0ZoB51XCA_4=CGu8cO6LoKw9RF5pBuYDoQJfHA6h_g@mail.gmail.com> <vb6i3c$2dt$1@ciao.gmane.io> <CAGJtH9Skc3ei1VzNock=w_-CoLtyMm-+TbRgMxsFDH1Mr7FROQ@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de 0luPinS6qUElkp2vmkvXWwjdJZDUx0MzzyUlhXcrqFQg== Cancel-Lock: sha1:708E5VepukBqRA6XwGORiRR0hRQ= sha256:kedoc/d2oBmBZ24801R5ltG6YNmbSFtLpzIt5G1Y0dk= Return-Path: <mk1853387@gmail.com> X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org Authentication-Results: mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=g8s5uwN0; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04; 'thread': 0.05; 'world"': 0.05; '"hello': 0.07; 'subject:error': 0.07; 'subject:module': 0.07; '-\xc2\xa0': 0.09; '2.7': 0.09; 'cc:addr :python-list': 0.09; 'skip:\xc2 20': 0.09; 'subject:not': 0.09; 'subject:skip:P 10': 0.09; 'subject:Python': 0.12; '>': 0.14; 'import': 0.15; 'url:mailman': 0.15; 'that.': 0.15; "(i'm": 0.16; '2024': 0.16; '3.x': 0.16; 'alan,': 0.16; 'displayed': 0.16; 'flickr': 0.16; 'gauld': 0.16; 'message?': 0.16; 'photo-blog': 0.16; 'pickle': 0.16; 'question,': 0.16; 'subject: <': 0.16; 'subject:() ': 0.16; 'subject:2.7': 0.16; 'subject:found': 0.16; 'subject:skip:p 20': 0.16; 'threading': 0.16; 'url- ip:79.170.44.132/32': 0.16; 'url-ip:79.170.44/24': 0.16; 'url- ip:79.170/16': 0.16; 'url-ip:79/8': 0.16; 'url:alan-g': 0.16; 'url:alan_gauld': 0.16; 'url:alangauldphotos': 0.16; 'url:tutor': 0.16; 'wrote:': 0.16; 'problem': 0.16; 'python': 0.16; 'probably': 0.17; "can't": 0.17; 'url:amazon': 0.19; 'cc:addr:python.org': 0.20; 'subject:: [': 0.21; 'subject:] ': 0.21; 'skip:_ 10': 0.22; 'code': 0.23; 'cc:2**1': 0.23; 'url-ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25; 'url:listinfo': 0.25; 'url- ip:188.166/16': 0.25; 'normally': 0.26; 'function': 0.27; 'email addr:python.org>': 0.28; 'error': 0.29; 'skip:_ 40': 0.31; 'module': 0.31; 'url-ip:188/8': 0.31; 'program': 0.31; 'think': 0.32; 'anybody': 0.32; 'python-list': 0.32; 'returning': 0.32; 'subject:Can': 0.32; 'subject:Tutor': 0.32; 'message- id:@mail.gmail.com': 0.32; 'but': 0.32; 'there': 0.33; 'windows': 0.34; 'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34; 'running': 0.34; 'following': 0.35; 'from:addr:gmail.com': 0.35; 'display': 0.36; 'change': 0.36; "skip:' 10": 0.37; 'using': 0.37; "it's": 0.37; 'author': 0.37; 'others': 0.37; 'file': 0.38; 'could': 0.38; 'put': 0.38; 'thanks': 0.38; 'use': 0.39; 'much.': 0.39; 'neither': 0.39; 'alan': 0.40; 'learn': 0.40; 'something': 0.40; 'hello,': 0.40; 'should': 0.40; 'including': 0.60; 'provide': 0.60; 'tutor': 0.61; 'skip:\xc2 10': 0.62; 'here': 0.62; 'follow': 0.62; '8bit%:9': 0.64; 'full': 0.64; 'upgrade': 0.64; 'your': 0.64; 'named': 0.65; 'years': 0.65; 'skip:t 20': 0.66; 'url-ip:18/8': 0.67; 'right': 0.68; 'url:author': 0.69; 'site': 0.70; 'unsubscribe': 0.72; 'mar.': 0.84; 'respects': 0.84; 'skip:p 50': 0.84; 'subject: \n ': 0.84; 'world"': 0.84; '\xc3\xa9crit\xc2\xa0:': 0.84; 'subject:type': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725356102; x=1725960902; darn=python.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4ol645Yz9JOPde5gmRgW00QDbm7O9mQUy6td4QAoItY=; b=g8s5uwN0jNRDlukJAn8KLgTD4SocdP9nBGw+60FgO+qcf346q1UmTzhKoYPwyj+qRO vjQNYGGxndb0Yi+OELZU5mAlrEXR7t4MsEhSkSFZ5WNw+hqoFR+Pur10udNCsNomN5yD XAck+KGQHTP+xPeNEkF2dXql2nzIIW0zjLtmYcbU7G/8Lh6/nUSHosADiAfbaDpqbv9j HM1yVcrcWgNVBT6VFrnDu6LIYLMojvmSkakqJCBY2044EVBSqvbU7TVTXb7S9iF+8keb 8TbFFeEKsBPc58sSleppqcq3REuJtNjtq8PT6G6Z756BQUvZ5hrTuFj7T8gbpmjgcXhQ Y8yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725356102; x=1725960902; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4ol645Yz9JOPde5gmRgW00QDbm7O9mQUy6td4QAoItY=; b=C7AtoRJmpBAjfI+2DQlOjEAK58grLXlTYTDMXxWuSjlbasEzOOO562BeHAJ1p9q8Ra ElxYUnd3zWh8Ps2BWoVHU+tClhF7L16GtKEa0/xH98nuPVx0igZzTACkZZdq3w3h+HZ2 LGAWSGroz+e3dqRuAjzIDo3hnYyIHBKmrxXa/5DJ8ZUieGFrb3shYsM0EM0gbLfifEao qNWdTUbO8N22/Fk4iEJCn1UYbAQAKb++0Eymc5LvUOWS5NimnQSKF5nks/ksbcHbWreE AZSl+sK4c/2f9eflVWV/+G6ru6Q6NI6Ue7c9KFIP6nV9VJCr5MmtXXHlmOeuZGsd+Uo0 /4Qg== X-Forwarded-Encrypted: i=1; AJvYcCUATVimTFtOjOyb+XynYfAlq3HY7/ADG0COJs8M1xxmgrhKmTqkUcH6NzPwx5U6PiNc/Iszg1C0AwWQlg==@python.org X-Gm-Message-State: AOJu0YzqgQd64m4MZPlTVk2XEYLw0TZpTNm/rbi9SPoQQqL/sWzLysG8 KDj9HaseIxmI4vWRmmPqhyju7VVnNmUq3RLAdUcNdYxURL8AFPsD/nIn2KfLDLZKTR3VBnDPqHN iSK0mV1Uy2JAEP+vKhmCxLAWzwn+SDK3c X-Google-Smtp-Source: AGHT+IGkEmRk/z7kT2+L08ALCYsRjQYlGcKMzv3HcNB+rfQaCzqGNt702zFGzSh/EisjZMmgXRqJNfMYPQPWy3lSAY4= X-Received: by 2002:a05:690c:1d:b0:6c1:2ea1:c24d with SMTP id 00721157ae682-6d40e38a1b1mr162328407b3.26.1725356102515; Tue, 03 Sep 2024 02:35:02 -0700 (PDT) In-Reply-To: <vb6i3c$2dt$1@ciao.gmane.io> X-Content-Filtered-By: Mailman/MimeDel 2.1.39 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: General discussion list for the Python programming language <python-list.python.org> List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> List-Archive: <https://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: <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> X-Mailman-Original-Message-ID: <CAGJtH9Skc3ei1VzNock=w_-CoLtyMm-+TbRgMxsFDH1Mr7FROQ@mail.gmail.com> X-Mailman-Original-References: <CAGJtH9Tw0ZoB51XCA_4=CGu8cO6LoKw9RF5pBuYDoQJfHA6h_g@mail.gmail.com> <vb6i3c$2dt$1@ciao.gmane.io> Bytes: 9848 Hello Alan, Thanks for the reply, Here's the code I tested for the debug: import time from multiprocessing import Process def do_Something(): print('hello world!') def start(fn): p =3D Process(target=3Dfn, args=3D()) p.start() def ghello(): print ("hello world g") def fhello(): print('hello world f') if __name__ =3D=3D "__main__": start(do_something) print("executed") exit(0) but neither "Hello World" or "Executed" are displayed in the console which finishes normally without returning any message. Module naming is OK and don't think it is a problem related to that. Now the question, when to use Process/Multiprocess and when to use Threading in Python?.Thread is there a distinctive use case that can showcase when to use either? are they interchangeable? to note that using Threading the console DID display the messages correctly! Thanks. Le mar. 3 sept. 2024 =C3=A0 10:48, Alan Gauld via Tutor <tutor@python.org> = a =C3=A9crit : > On 02/09/2024 15:00, marc nicole via Python-list wrote: > > Hello, > > > > I am using Python 2.7 on Windows 10 > > Others have pointed out that 2.7 is unsupported and has > been for many years now. Its also inferior in most > respects including its error reporting. > If possible you should upgrade to 3.X > > > from multiprocessing import Process > > def do_something(text): > > print(text) > > if __name__ =3D=3D "__main__": > > q =3D Process(target=3Ddo_something,args=3D("somecmd") ) > > q.start() > > # following code should execute right after the q.start() call > > So what does happen? If you put a print statement here does it execute > before or after the error message? It might make things easier to > debug(clearer error traceback) if you put the code to create the thread > into a separate function? > > def do_Something(text)... > > def start(fn): > q =3D Process.... > q.start() > > if __name_.... > start(do_something) > print('Something here') > > > > But getting the error at the call of Process().start(): > > pickle.PicklingError: Can't pickle <type 'module'>: it's not found as > > __builtin__.module > > But please show us the full error trace even if its not much. > > Also check your module naming, is there a possibility > you've named your file do_something.py or similar? > (I'm guessing the function is what is being pickled?) > ========== REMAINDER OF ARTICLE TRUNCATED ==========