Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to sharing object between multiple process from main process using Pipe
I try to call multiprocessing to act my process faster.
At the moment I face some problems sharing some data with many processes from main process.
I use multiprocess.pipe() to pass the data.

I use multiprocess.manager to pass the data.

1. Initialization:-


global devices
self.listofwritetags = self.collectwritetaglist()
conn1, conn2 = multiprocessing.Pipe()
devices = bussiness.initilaztion(self.comm_object,logger)
self.callmotor1dprocess =

2.Start and stop process:-

def startprocess(self):
for item in self.listofprocess:

def stopprocess(self):
for item in self.listofprocess:


self.button3 = ttk.Button(self.frame, text='Start', command=self.startprocess,state =NORMAL)
self.button3.grid(column=1, row=4, sticky=W,padx=5, pady=5)

self.button4 = ttk.Button(self.frame, text='Stop', command=self.stopprocess, state=NORMAL)
self.button4.grid(column=1, row=5, sticky=W, padx=5, pady=5)

I need to call avobe 3 process in one class:- FormUI

but I call executable process outside of the FormUI class.

I got an error when I try to initialize.I want to pass devices from main process to child process.

The calling method:-

def callallmotor1d(conn):
devices = conn.recv()

def callallsov1s(conn):
devices = conn.recv()

Any help regarding this would be appreciable

Error messege:-

2019-09-03 13:15:33,755: can't pickle _thread.lock objects
Traceback (most recent call last):
File "C:/Users/misu01/PycharmProjects/opcua/", line 226, in initilization
File "C:\Users\misu01\AppData\Local\Programs\Python\Python37\lib\multiprocessing\", line 206, in send
File "C:\Users\misu01\AppData\Local\Programs\Python\Python37\lib\multiprocessing\", line 51, in dumps
cls(buf, protocol).dump(obj)
TypeError: can't pickle _thread.lock objects
Larz60+ wrote Sep-03-2019, 04:01 PM:
Please post all code, output and errors (in it's entirety) between their respective tags. Refer to BBCode help topic on how. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
self.listofprocess has not been declared anywhere in the code you posted
def startprocess(self):
    for item in self.listofprocess:

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  win32 API: Launch Application to RDP session from background process python script rangeshgupta 0 64 May-28-2020, 09:41 PM
Last Post: rangeshgupta
  kill thread or process asap, even during time.sleep nanok66 4 256 Apr-29-2020, 10:13 AM
Last Post: nanok66
  Spawning a new process that is not attached to python cman234 3 141 Apr-25-2020, 05:24 PM
Last Post: cman234
  psutil for monitor a software finish process and notification Pyguys 0 287 Mar-27-2020, 11:15 PM
Last Post: Pyguys
  multiprocessing Pipe.poll very slow seandepagnier 0 221 Mar-09-2020, 03:10 AM
Last Post: seandepagnier
  Process (pool,map) strange behaviour maverick76 1 264 Feb-03-2020, 02:43 PM
Last Post: maverick76
  connecting to the spreadsheet object inside multiple enterprise software apps ajetrumpet 0 221 Jan-19-2020, 03:36 PM
Last Post: ajetrumpet
  How to process JSON response from requests? Heinrich 5 449 Jan-10-2020, 06:17 PM
Last Post: Heinrich
  How to make a simple automation process of login using "if condition" soimba 3 359 Jan-07-2020, 11:58 PM
Last Post: SheeppOSU
  ending process hrparra 1 263 Jan-07-2020, 07:40 PM
Last Post: ibreeden

Forum Jump:

Users browsing this thread: 1 Guest(s)