[python-win32] problem list process

wowberk wowberk at gmail.com
Thu Oct 23 00:02:55 CEST 2008


Hello,

I have a problem with this code to list the processes. How do I remove the
reference to the subject?


def P_buscar_proceso(self,proceso,intentos):
        # P_buscar_proceso(self,proceso,intentos=1):
        # Se obtiene la lista de procesos y se mira si existe,
        # Si intento no se define, solo se mira 1 vez
        import win32pdh
        contador=0
        list = None
        while contador < intentos:
            contador = contador + 1
            del list

            list = win32pdh.EnumObjectItems(None, None , 'proceso' ,
win32pdh.PERF_DETAIL_WIZARD , 0 )
            print list
            x = proceso in list[1]
            print x
            if x == 1:
                result = "  "+proceso+" Is Running"
                print result
                break
            else:
                result = "  "+proceso+" Is Not Running..."
                #win32api.WinExec("+proceso+")
                print result
        return("  "+proceso+" Is Not Running...")


P_buscar_proceso(None,"processexplorer",1000)

Un saludo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20081023/90ba2b25/attachment.htm>


More information about the python-win32 mailing list