Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #144: Too few computrons available.


comp / comp.lang.python / 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

SubjectAuthor
o RE: [Tutor] Getting a Process.start() error pickle.PicklingError:<avi.e.gross

1
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
From: <avi.e.gross@gmail.com>
Newsgroups: comp.lang.python
Date: Wed, 4 Sep 2024 05:19 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: <avi.e.gross@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: Wed, 4 Sep 2024 01:19:12 -0400
Lines: 94
Message-ID: <mailman.32.1725427155.2917.python-list@python.org>
References: <CAGJtH9Tw0ZoB51XCA_4=CGu8cO6LoKw9RF5pBuYDoQJfHA6h_g@mail.gmail.com>
<vb6i3c$2dt$1@ciao.gmane.io>
<059301dafe89$fac57470$f0505d50$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de PN/xu+xTH1/EaQTJkNqdWQMDLRCuF7FKSzsohJehzX3w==
Cancel-Lock: sha1:ibYY+Xj01L0jNpPep47OdqTLVbI= sha256:9bvm3Dz+hqEck90lfEwHy2L06qBnKsUu2+ApFgEoQPk=
Return-Path: <avi.e.gross@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=HqO047KS;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.005
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'def': 0.04; 'thread':
0.05; 'subject:error': 0.07; 'subject:module': 0.07; '2.7': 0.09;
'cc:addr:python-list': 0.09; 'subject:not': 0.09; 'subject:skip:P
10': 0.09; 'subject:Python': 0.12; 'cc:no real name:2**0': 0.14;
'import': 0.15; 'url:mailman': 0.15; 'supported': 0.15; "(i'm":
0.16; '2024': 0.16; '3.x': 0.16; 'alan,': 0.16; 'devices': 0.16;
'flickr': 0.16; 'gauld': 0.16; 'message?': 0.16; 'photo-blog':
0.16; 'pickle': 0.16; 'refuse': 0.16; 'stuck': 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; 'python': 0.16; 'probably': 0.17; "can't":
0.17; 'message-id:@gmail.com': 0.18; 'url:amazon': 0.19;
'cc:addr:python.org': 0.20; 'subject:: [': 0.21; 'subject:] ':
0.21; 'skip:_ 10': 0.22; 'version': 0.23; 'code': 0.23; 'skip:-
10': 0.25; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'url:listinfo': 0.25; 'cc:2**0': 0.25;
'url-ip:188.166/16': 0.25; 'questions,': 0.26; 'answering': 0.26;
'function': 0.27; 'old': 0.27; 'error': 0.29; 'packages': 0.31;
'skip:_ 40': 0.31; 'module': 0.31; 'url-ip:188/8': 0.31;
'wondering': 0.31; 'program': 0.31; 'answers': 0.32; 'anybody':
0.32; 'python-list': 0.32; 'subject:Can': 0.32; 'subject:Tutor':
0.32; 'but': 0.32; 'there': 0.33; 'windows': 0.34; 'able': 0.34;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'running': 0.34; 'officially': 0.35; 'following': 0.35;
'from:addr:gmail.com': 0.35; 'people': 0.36; 'change': 0.36;
'using': 0.37; "it's": 0.37; 'author': 0.37; 'others': 0.37;
'though': 0.37; 'file': 0.38; 'could': 0.38; 'put': 0.38;
'otherwise': 0.39; 'use': 0.39; 'much.': 0.39; 'received:100':
0.39; 'still': 0.40; 'alan': 0.40; 'learn': 0.40; 'something':
0.40; 'hello,': 0.40; 'want': 0.40; 'should': 0.40; 'including':
0.60; 'provide': 0.60; 'tutor': 0.61; 'from:': 0.62; 'to:': 0.62;
'apps': 0.62; 'here': 0.62; 'follow': 0.62; 'updates': 0.64;
'full': 0.64; 're:': 0.64; 'upgrade': 0.64; 'your': 0.64; 'named':
0.65; 'required': 0.65; 'years': 0.65; 'let': 0.66; 'back': 0.67;
'that,': 0.67; 'url-ip:3/8': 0.67; 'right': 0.68; 'and,': 0.69;
'cc:': 0.69; 'url:author': 0.69; 'site': 0.70; 'companies': 0.70;
'longer': 0.71; 'unsubscribe': 0.72; 'equipment': 0.75; 'well!':
0.76; 'sent:': 0.78; 'reasons': 0.84; 'allowed.': 0.84; 'bottle':
0.84; 'respects': 0.84; 'samsung': 0.91; 'subject:type': 0.91;
'interest.': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1725427153; x=1726031953; darn=python.org;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:cc:to
:from:from:to:cc:subject:date:message-id:reply-to;
bh=9VWCdgHFmVJVX4KbrnKArBwPBsLh7UdpQuWSDEoaijc=;
b=HqO047KSJRaE9zFBCNO/1/meHZToMUdk4YYUNBPDp/G5fJGQVWJSAGpzfX5x47p2so
VqYip7mXmEnNBj/kTtJyTMOeIEaETfZv+x3de/cQM2LUzs+J+I7RCaEvax1wWVB29LRQ
zenDPYEtxhdwjhCSxn4sfKWJYXZMvFMssu6tt1WQUw7mcop5iwKXhPSLI2M0kNihTtIw
wUVZsdLSLOmRZFyDtMBWO8ZJ7ibh8zSVOaNU9gM+fjKK3i5OFY34D5gWHbgWGvLwTfXn
sYB2OhpPktlcAUAq0zTfa3CGrLZCQME8n9yfqbitZLwFuc+tHnn6XKsktHjaqPT8vhsh
VnEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1725427153; x=1726031953;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:cc:to
:from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=9VWCdgHFmVJVX4KbrnKArBwPBsLh7UdpQuWSDEoaijc=;
b=iIcxRnvdPKF19iBJziiOlpKdu+AygS/ujfSUTO45DjgU0gb6ErVANP9SudTxS1Tt0h
THvyfDepR3yxGUSety4kxzVDckJH83aBOkK/mmBPDXBCTXpWdUPdUik9/mVLYfwo96ev
TD14KwYCWCfzPZGyeIubb1ji5KS7PffTiyxbSAvpOBpL1+xmv9UUjz+Bm2Lzq9uvovM1
2muJMizCqGB57/jQv86J6nIEak2Zifz5QDC60Cw5egmQucpFo4nynrvrovceBLlQphKr
TGnfZzeS93DzMLM9npiGO94TrIcF1WQdXskOYfcW1UV/9tN2rti8UoGMgU3d+lv8OcMw
+vgA==
X-Forwarded-Encrypted: i=1;
AJvYcCWvLD9LFUsjXZNrYvCNC5Ij2mMudHKmW32zLRp39F/xrgXZL68dKuVcbvEAL5y8ylG1nbe/4Q==@python.org
X-Gm-Message-State: AOJu0YyQPO7SwxWoXCEZe4j1F7ecl+l5CS3lc0ZbA9Lvcc6WkKwnamV0
mThTh9eP/9QnFJtnupFEHZlaR7vBShyAI7h60Ai+AJIhRSx4buGoPyNgddiF
X-Google-Smtp-Source: AGHT+IGH69ntlPUQMT6zyOK3SlyEkT9KBDxUwHmQWRw1opEZ4iQuCt7RDKZFmHJk0MGnmAfiUrF48g==
X-Received: by 2002:a25:bc89:0:b0:e1a:8343:50da with SMTP id
3f1490d57ef6-e1a83435372mr13355723276.52.1725427152785;
Tue, 03 Sep 2024 22:19:12 -0700 (PDT)
In-Reply-To: <vb6i3c$2dt$1@ciao.gmane.io>
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQH9YnOU4mAVqq6Uw2Nuw/lL6OukCwKWhFJSse2ZarA=
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: <059301dafe89$fac57470$f0505d50$@gmail.com>
X-Mailman-Original-References: <CAGJtH9Tw0ZoB51XCA_4=CGu8cO6LoKw9RF5pBuYDoQJfHA6h_g@mail.gmail.com>
<vb6i3c$2dt$1@ciao.gmane.io>
View all headers

Unfortunately, Alan, even though 2.7 was considered pickled, people keep
taking it back out of the bottle and wondering why it does not work so well!

There are companies like Microsoft and Samsung that let people know their OS
on their devices will no longer be supported with updates and some apps may
no longer work if downloaded. And, yet, I bet for years afterwards, people
will refuse to upgrade because they don't want to replace equipment or even
learn a new slightly different interface.

Having said that, I understand many people are stuck for various reasons and
are required to use whatever version is officially allowed. For some
questions, answers may still be provided. There are some workarounds or even
newer packages designed to do what is not otherwise available.

But many of us here may not be answering the questions as we have no reason
to be able to access the old software or interest.

-----Original Message-----
From: Tutor <tutor-bounces+avi.e.gross=gmail.com@python.org> On Behalf Of
Alan Gauld via Tutor
Sent: Tuesday, September 3, 2024 4:41 AM
To: tutor@python.org
Cc: python-list@python.org
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

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__ == "__main__":
> q = Process(target=do_something,args=("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 = 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?)

> anybody could provide an alternative to call the function do_something()
in
> a separate thread ?

Why not just use the Threading module?
If it's as simple as just running something in a
thread multiprocessing is probably not needed.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

1

rocksolid light 0.9.8
clearnet tor