subprocess.Popen on Windows

W

Werner F. Bruhin

I am trying to use subprocess - it basically works but.

command = 'ping ' + '-n '+ str(count) + ' -l ' +
str(size) + ' ' + str(node)
print command
p = subprocess.Popen(command, stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
pout = p.stdout.read()

This works for me but I see the Windows command window, is there a way
to call subprocess without a command window showing?

I am trying to replace:

fdout, fdin = popen2.popen4('ping -n '+ str(count)+ ' -l '+ str(size) +'
'+node)

Which did not show the command window.

I did quit a bit of googling bug so far did not find an answer to my
problem.

Appreciate any hints on how this can be accomplished.

Werner
 
E

Eric Carlson

Werner said:
I am trying to use subprocess - it basically works but.

command = 'ping ' + '-n '+ str(count) + ' -l ' +
str(size) + ' ' + str(node)
print command
p = subprocess.Popen(command, stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
pout = p.stdout.read()

This works for me but I see the Windows command window, is there a way
to call subprocess without a command window showing?

I am trying to replace:

fdout, fdin = popen2.popen4('ping -n '+ str(count)+ ' -l '+ str(size) +'
'+node)

Which did not show the command window.

I did quit a bit of googling bug so far did not find an answer to my
problem.

Appreciate any hints on how this can be accomplished.

Werner

Try:

p = subprocess.Popen(command, shell=True, tdin=subprocess.PIPE,
stdout=subprocess.PIPE)

was working on xp and osx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top