Jul-15-2020, 07:03 PM
Solution:
multiprocessing disables the stdin when it starts a process, therefore input() cannot be used.
https://stackoverflow.com/questions/4283...ing-a-line
I've instead swapped to using a Thread to listen for the input:
multiprocessing disables the stdin when it starts a process, therefore input() cannot be used.
https://stackoverflow.com/questions/4283...ing-a-line
Quote:The multiprocessing module doesn't let you read stdin. That makes sense generally because mixing stdin readers from multiple children is a risky business. In fact, digging into the implementation, multiprocessing/process.py explicitly sets stdin to devnull:
sys.stdin.close()
sys.stdin = open(os.devnull)
I've instead swapped to using a Thread to listen for the input:
from threading import Thread # Main execution starts here Thread(target=listenForCommand).start()