"Schollnick, Benjamin" wrote: > Except that they do not seem to work.... I have tried three so far, and > they all fail with object has no attribute errors... > > Either that, or there is a significant difference with ActiveState & > standard > Python 2.4.1 with the Win32all extensions... (I don't remember a > significant difference... > I have previously used ActivateState back in the v2.0 / v2.1 days...) > > For example... > > def windows_installed_software ( host_computer = "."): > import win32com.client > strComputer = host_computer > objWMIService = > win32com.client.Dispatch("WbemScripting.SWbemLocator") > objSWbemServices = > objWMIService.ConnectServer(strComputer,"root\cimv2") > colItems = objSWbemServices.ExecQuery("Select * from Win32_Product") > for objItem in colItems: > print "Caption: ", objItem.Caption > print "Description: ", objItem.Description > print "Identifying Number: ", objItem.IdentifyingNumber > print "Install Date: ", objItem.InstallDate > print "Install Date 2: ", objItem.InstallDate2 > print "Install Location: ", objItem.InstallLocation > print "Install State: ", objItem.InstallState > print "Name: ", objItem.Name > print "Package Cache: ", objItem.PackageCache > print "SKU Number: ", objItem.SKUNumber > print "Vendor: ", objItem.Vendor > print "Version: ", objItem.Version > > They are obviously missing a step, because the colItems / > ExecQuerry is working, but > objItems does not have any of the Caption / Description, etc > variables.... > > So there must be a missing step.... >
WMI properties work differently depending on whether you've created the makepy generated file. Delete everything in the folder \win32com\gen_py and the above code should work. You can also use win32com.client.dynamic.DumbDispatch in place of win32com.client.Dispatch to explicitely avoid using it. hth Roger _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32