[Tutor] Apparent incosistency with Python interperter in IDLE
Lie Ryan
lie.1296 at gmail.com
Thu Jun 18 19:20:48 CEST 2009
Luke Paireepinart wrote:
> So the problem is that the stdout of the "ls" command is appearing in
> some location that you cannot see.
> As for ways to remedy this - I don't know. The idea here, though, is
> that even though the regular Python version has the side-effect that it
> outputs it in the console, that's not necessarily what you want it to
> do. The reason is that you have no way to access that data.
You have to explicitly redirect the stdout from subprocess
subprocess.Popen(['ls'], stdout=...)
What you're seeing is a side effect of the nature of the interactive
console and IDLE. The defined behavior of python is when it is being run
from a script.
More information about the Tutor
mailing list