on win 7 i can communicate with a chess engine via commandline. Small Example Session with Stockfish on Win 7:
C:\\run\\Stockfish>stockfish-x64.exe Stockfi
You've got a deadlock: the subprocess is waiting for input, while your program is waiting for it to output more lines in
for line in engine.stdout: print(line.strip())
This loop only stops when the subprocess closes its stdout.
stdout