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

Orri Ganel singingxduck at gmail.com
Sat Jan 15 17:56:26 CET 2005


Alan Gauld wrote:

>>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.
>
>
>  
>

Well, ultimately, what I want to be able to do is open Audacity 
(http://audacity.sourceforge.net/) at a predetermined time and have it 
begin recording wave mix out (the default i have it set to anyway), and 
then have it stop again when i send it a command.  This is basically to 
automate recording once a song begins playing in a certain media player, 
and stop recording when it's over. I don't know if it would be easier to 
do any or all of it in Python than in the DOS box, but since I have 
trouble with sending commands to the DOS box, I imagine sending commands 
to Audacity will be even more troublesome.

Right now I have little to no idea where to go from here. I have the 
idea of what I want to do, but no knowledge on how to do it. Once again, 
any help would be appreciated.

Thanks in advance,
Orri

-- 
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050115/6398bde1/attachment.htm


More information about the Tutor mailing list