[Tutor] os.popen4 help!

Jeff Peery jeffpeery at yahoo.com
Tue Mar 16 21:56:40 CET 2010

I'm trying to run an executable file from a python script. the executable is "opcenum.exe".

 is an executable that is usually found on computers with OPC software; 
such as OPC Servers or OPC Clients. The purpose of OPCENUM.EXE is 
                                to provide an interface into the local 
machine's Component Category Manager that can be accessed by remote OPC 
clients over DCOM.  OPCEnum.exe provides several useful methods
 - gets available OPC servers for a specified category of OPC server
I want to use IOPCServerList::EnumClassesofCategory but I am having some trouble. currently I do the below:

import os
cmd = 'opcenum.exe/IOPCServerList/EnumClassesofCategory 63D5F432-CFE4-11d1-B2C8-0060083BA1FB'
fin,fout = os.popen4(cmd)
result = fout.read()

this doesn't work, and it hangs up on fout.read(). I'm do not understand the syntax of the arguments in popen4, i.e., I'm using slashes to get to the EnumClassesofCategory method, but should I use periods or what. The long number at the end is the argument to EnumClassesofCategory, and is the component category CLSID. 

details are here: http://opcactivex.com/Support/General/OPCEnum/opcenum.html

how can I improve things here?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100316/2b21bbfd/attachment.html>

More information about the Tutor mailing list