It makes a file called cmd_help.txt in the current directory. Did you look for that? The file contains the result of asking for help on every command. Kind of cool!
Kent Dick Moores wrote: > Found this in comp.lang.python. The Google link is > <http://groups.google.com/group/comp.lang.python/msg/9fa3a3c287e8e2a3?dmode=source> > > ================================= > import subprocess as subp > > p = subp.Popen("cmd.exe /X/D/F:ON", stdin=subp.PIPE, > stdout=subp.PIPE, stderr=subp.STDOUT) > flag = "(@@@@@@}" > print >>p.stdin, "PROMPT", flag > print >>p.stdin, "HELP" > print >>p.stdin, "EXIT" > text = p.stdout.read() > p.wait() > helptext = text[text.index(flag + 'HELP') + len(flag) + 4 : > text.index(flag + 'EXIT')] > words = [line.split(None, 1)[0] > for line in helptext.split('\n') > if line.strip()] > commands = [word for word in words if word.isupper()] > > dest = open('cmd_help.txt', 'wb') > p = subp.Popen("cmd.exe /X/D/F:ON", stdin=subp.PIPE, > stdout=dest, stderr=subp.STDOUT) > print >>p.stdin, "PROMPT (@@@@@@@@)" > print >>p.stdin, "HELP" > for command in commands: > print >>p.stdin, "HELP", command > print >>p.stdin, "EXIT" > p.wait() > dest.close() > =================end of script============= > > When I run this I get no text, but just a series of cmd.exe windows > entitled HELP <command>. How do I get any text? > > Thanks, > > Dick Moores > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor