Pythonwin can't resolve WMI instances

Benjamin Derstine bend at ecollege.com
Mon Oct 23 12:28:39 EDT 2000


Thank you- that was the solution.

"Roger Upole" <rupole at msn.com> wrote in message
news:TjMI5.122986$86.9744286 at pouncer.easynews.com...
> If you've run makepy on WMI, only the properties defined in the object
> library can be accessed
> with the 'object.property' notation.  You can use the more verbose
notation
> print cpu.Properties_('Name'), cpu.Properties_('CurrentClockSpeed'),
> cpu.Properties_('Description'), cpu.Properties_('L2CacheSize')
> to access properties from the WMI provider itself with makepy support.
>
>     Roger Upole
>
> "Benjamin Derstine" <bend at ecollege.com> wrote in message
> news:X5_H5.7008$rD3.235678 at newsread2.prod.itd.earthlink.net...
> > When I try to run the exact code below (except for changing the computer
> > name) I get an "AttributeError: Name" error for the last line.  I
inspect
> > the object type and the object type is correct- ISWbemObject.  It seems
> that
> > Pythonwin can only see the generic classes for WMI and can't seem to
> access
> > instances and their dynamic properities. I also tried enumerating the
> > software products on my machine and got the same result- the returned
> > objects have class types that are correct but no instance information is
> > accessible.  I'm running a Win2000 system and when I run the equivalent
> code
> > using VBS (with WSH) everything works fine. Is there something else I
need
> > to do to make Pythonwin aware of WMI?
> >
> > Ben
> >
> > Subject: Re: System information on Windows?
> > Date: 09/19/2000
> > Author: Roger Upole <rupole at compaq.net>
> >
> >
> >       If you don't mind installing WMI (a free download from Microsoft)
on
> > all the machines in question, you can do things like this:
> >
> >       import win32com.client
> >       wmi = win32com.client.Dispatch('wbemscripting.swbemlocator')
> >       rmt_mach = wmi.ConnectServer('machine name')
> >       cpus = rmt_mach.InstancesOf('Win32_Processor')
> >       for cpu in cpus:
> >           print cpu.Name, cpu.CurrentClockSpeed, cpu.Description,
> > cpu.L2CacheSize
> >
> >       For my machine, this returns
> >           Intel Pentium III processor 450 x86 Family 6 Model 7 Stepping
3
> > 512
> >
> >       HTH
> >       Roger Upole
> >
> >
> >
> >
> >
> >
>
>
>
>





More information about the Python-list mailing list