D
Dhanesh
Hi ,
I am trying to use subprocess popen on a windows command line
executable with spits messages on STDOUT as well as STDIN. Code
snippet is as below :-
##########################################################################
sOut=""
sErr=""
javaLoaderPath = os.path.join("c:\\","Program Files","Research In
Motion","BlackBerry JDE 4.7.0","bin","Javaloader.exe")
cmd = [javaLoaderPath,'-u','load','helloworld.jad']
popen = subprocess.Popen
(cmd,bufsize=256,shell=False,stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
while True:
sErr = sErr + popen.stderr.read(64)
sOut = sOut + popen.stdout.read(64)------------------> Blocks
here
if None != popen.poll():
break;
##########################################################################
I observed that python scripts blocks at stdout read on the other hand
when I do not create a child stdout PIPE say " stdout=None" , things
seems to be working fine.
how can I we have a non blocking read ?
And why does stdout block even where data is available to be read
( which seem to be apparent when stdout=None, and logs appear on
parents STDOUT) ?
I am trying to use subprocess popen on a windows command line
executable with spits messages on STDOUT as well as STDIN. Code
snippet is as below :-
##########################################################################
sOut=""
sErr=""
javaLoaderPath = os.path.join("c:\\","Program Files","Research In
Motion","BlackBerry JDE 4.7.0","bin","Javaloader.exe")
cmd = [javaLoaderPath,'-u','load','helloworld.jad']
popen = subprocess.Popen
(cmd,bufsize=256,shell=False,stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
while True:
sErr = sErr + popen.stderr.read(64)
sOut = sOut + popen.stdout.read(64)------------------> Blocks
here
if None != popen.poll():
break;
##########################################################################
I observed that python scripts blocks at stdout read on the other hand
when I do not create a child stdout PIPE say " stdout=None" , things
seems to be working fine.
how can I we have a non blocking read ?
And why does stdout block even where data is available to be read
( which seem to be apparent when stdout=None, and logs appear on
parents STDOUT) ?