Newbie question about sending and receiving data to the command prompt.

aditya shukla adityashukla1983 at gmail.com
Tue Aug 19 15:48:26 EDT 2008


Hello folks,

I am using windows vista and i am trying to send data to the command prompt
,this is what is done.

import subprocess
proc =subprocess.Popen('cmd.exe',stdin=subprocess.PIPE)
proc.communicate('abc')
when i run this the command prompt just blinks and disappears , can anyone
explain what's going on?

Similarly when i am trying to receive data from the command prompt the same
thing happens.This is what i have done.

proc = subprocess.Popen('cmd.exe',stdout=subprocess.PIPE, )
stdout_value = proc.communicate()[0]
print '\tstdout:', repr(stdout_value)

-command prompt blinks and disappears.Please explain what's happening.

Thanks in advance.

Aditya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080819/dd91046c/attachment.html>


More information about the Python-list mailing list