I run a script that executes multiple processes, that are executed in different classes. The processes do not end unless the user asks for it. So in the main class I decided to create a process that will exit() the script, I supposed this will kill all the processes too. This is the main.py class.
def finishTest():
end = "notexit"
while end != "exit":
end = input("To finish the test type 'exit'")
exit()
if __name__ == '__main__':
fT = Process (target=finishTest)
fT.start()
#this are functions of this class that call functions from other classes that run the other processes.
askTest()
execTest()
When I execute the main.py the following error appears,
Traceback (most recent call last):
File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "execution.py", line 20, in finishTest
exit = input("To finish the test type 'exit'")
EOFError: EOF when reading a line
How do I correct this error? Isn't it this a correct way to stop a script and all the processes being executed by the script?
Thank you all!