psexec and os.popen help

D

dennis.scales

I'm trying to wrap a psexec command in a python script so I can capture
the results and generate an exception report. The problem I'm having is
that when I use x = os.popen("command") to do it, it runs, but the
content of x is empty. I know there should be output sent to it,
because when I run the command from the DOS prompt, it shows it. I
don't have this problem when wrapping other PSTools. Has anyone else
had this problem, or can someone try it and verify that it works, then
show me there work? I really appreciate it. Its been a late night.
Thanks

Dennis
 
V

Volker Grabsch

popen3 did the trick.

Use the modules "subprocess" ... it solves many problems, including
the problem of too many similar functions. :)

These functions (execl, execv, popen, popen2, popen3, ...) are relicts
from C and very unpythonic. It's IMHO always a better programming style
to use "subprocess".


Greets,

Volker
 

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,776
Messages
2,569,603
Members
45,216
Latest member
topweb3twitterchannels

Latest Threads

Top