[Tutor] Using os.popen*() and os.spawn*() to interact with a dos-box

Alan Gauld alan.gauld at freenet.co.uk
Sat Jan 15 13:09:55 CET 2005


> I'm trying to use Python to start the dos-box ("cmd.exe") and be
able to
> call commands on it and receive output from it.

The Command window is just a terminal, there is no output to
be had other than an exit code when it closes.

> However, none of the documentation for popen and
> spawn cover this . . .

Nope, there is nothing to be received from the terminal,
you might as well open Notepad and try to read output
from it (in fact that would probably work better!).

What is it you are trying to do using the DOS box?
Its probably easier to run the commands that you
would run inside the box from Python. But if you
are trying to monitor what *a user* is doing then
it gets more tricky.

Alan G.



More information about the Tutor mailing list