From: [email protected] [mailto:[email protected]] On Behalf Of Wayne Werner Sent: Wednesday, March 10, 2010 3:00 PM To: Armstrong, Richard J. Cc: [email protected] Subject: Re: [Tutor] Running a dos program with python On Wed, Mar 10, 2010 at 4:51 PM, Armstrong, Richard J. <[email protected]> wrote: The dos program pops up and if I hit the enter key three times then it runs. How can I add these three "enters" into the script? I'm not at all sure if this way would work, but you could send the \r\n through a pipe: p = subprocess.Popen([file1, file2, file3], stdin=subprocess.PIPE) p.communicate("\r\n\r\n\r\n") # Three windows line ending sequences. it also may be possible to add them to the end of the last parameter: 'b.txt\r\n\r\n\r\n' I don't have much faith that it will work, but you can certainly try! HTH, Wayne Wayne thank you so much! This worked beautifully: import subprocess p = subprocess.Popen([r'c:\shake91.exe', 'FLAC.txt', 'a.txt', 'b.txt'], stdin=subprocess.PIPE) p.communicate("\r\n\r\n\r\n") # Three windows line ending sequences.
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
