I want to make a multiprocessing program that runs concurrently.
So I want my process to keep counting every 5 seconds while another process keeps asking for an input and printing it.
and the process asking for two inputs should be running in an infinite loop because later I want to change it so that every input will be a value of number variable in the first process. (If you have any ideas to help me out with this too, please let me know! I really appreciate it)
This is the code I have and it just gives me EOFError: EOF when reading a line
import os
import time
from multiprocessing import Process
def doubler():
number =0
while True:
proc = os.getpid()
print('num : {0} by procss id : {1}'.format(number,proc))
time.sleep(5)
def test():
while True:
x = raw_input("input x : ")
y = raw_input("input y : ")
print('x = {0}, y = {1}'.format(x,y))
if __name__ == '__main__':
proc1 = Process(target=doubler)
proc2 = Process(target=test)
procs = []
procs.append(proc1)
procs.append(proc2)
proc1.start()
proc2.start()
for proc in procs:
proc.join()
Result ---> EOFError: EOF when reading a line