completed read/write loop (Python side)