Argaman Argaman - 1 month ago 13
Python Question

Python - EOF error while using multiprossecing and input

I'm trying to run a Python file, while using multiprossecing.

when I'm trying to use input on the same function I'm prossecing, it gives me EOF error, as follows:

Process PXB:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python35-32\lib\multiprocessing\process.py", line 254, in _bootstrap
self.run()
File "C:\Users\user\AppData\Local\Programs\Python\Python35-32\lib\multiprocessing\process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\user\PycharmProjects\PROJECT-XBIT\generator.py", line 56, in start
inputcode = input("Enter Passcode: ")
EOFError: EOF when reading a line


If you have any solution or maybe replacement for the multiprossing, that will still can count how much time the program will work, please explain how to use it, Thank you!

Answer

I think when you create a new process it gets its own standard input. If you use a thread instead it should be fine.

You can also just forget threads and processes and put a check on how much time has passed in the loop in the start function.