On 8/23/2013 2:13 PM, Guido van Rossum wrote:
I would recommend trying to use the subprocess module.

Rev 71746, 2011-8-3, switched subprocess startup from os.spawnv to subprocess for 3.2 +, but not for 2.7 ;-(.

I don't believe
it existed when I first designed this part of IDLE.

The 2.x startup line was last revised 2003-8-14 and must date from earlier. Subprocess arrived in 2.4, 2004 Nov 30.

However I would not
use communicate(), which is meant as a simplified API for sending one
input string and waiting for the subprocess to exit.

Or at least get whatever output is ready.

There is a low-level API to let you send multiple strings
> and receive output back as it becomes available.

Right, Popen.stdin/out/err are the 'file' objects.

os.popen3 also makes these available, but was unix, windows only. I presume that excludes classic Macs. Is that why sockets were used instead?

Switching from sockets, which do not always connect, to pipes established as part of the popen call should also make it more feasible to always run user code in a subprocess and eliminate the -n option.
http://bugs.python.org/issue16123
and thereby simplify some sections of code. Amaury suggested the switch on that issue.

(You may have to create threads to read stdout and stderr.)

I hope not ;-).

--
Terry Jan Reedy

_______________________________________________
IDLE-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/idle-dev

Reply via email to