I did some research about subprocess.popen but i can’t find an example the same with the code above. But my understanding with popen it will run the PyLocScript. And the area, xcor, ycor are values required by PyLocScript. Please correct me if am wrong. And what theproc.communicate() does? Hope someone can help explain in layman’s term…thanks in advance.
theproc.communicate() is a little odd, but it transfers data to and from the subprocess. It’s used to help deter deadlocks, but the important thing is just to know that this is how you get I/O to and from the subprocess.
In this case, p.communicate() is basically the same as p.wait(). On the other hand, if stdin, stdout, and stderr are set to subprocess.PIPE, then p.communicate(input) allows writing input to p.stdin and reading from p.stdout and p.stderr – all performed concurrently in order to avoid a deadlock between the parent and child.