Menu

#218 Early binding of WMI Scripting V1.2 Library hides properties

open
nobody
com (105)
5
2005-05-15
2005-05-15
No

Using the microsoft sample code located at
http://www.microsoft.com/technet/scriptcenter/scripts/python/ad/domains/addmpy01.mspx,
I find that the code will not run if the the scripting
library (Microsoft WMI Scripting V1.2 Library) is
configured for early binding (that is, I use the makepy
utility). If I remove the early binding, the script
runs fine.

With early binding enabled, I get the following output:

--- begin output ---
Caption:
Traceback (most recent call last):
File "C:\bin\domain_enum.py", line 7, in ?
print "Caption: ", objItem.Caption
File "C:\Program
Files\Python\Lib\site-packages\win32com\client\__init__.py",
line 454, in __getattr__
raise AttributeError, "'%s' object has no attribute
'%s'" % (repr(self), attr)
AttributeError: '<win32com.gen_py.Microsoft WMI
Scripting V1.2 Library.ISWbemObjectEx instance at
0x14848208>' object has no attribute 'Caption'
--- end output ---

I have found that the objItem.Caption attribute is not
available, but I can use objItem.Properties_.Item(
'Caption' ).Value to acquire the correct result.

I am unsure how to approach this problem, but I post it
for public knowledge. I will be happy to look into the
problem further or provide more information, but I
would need some direction to proceed.

Discussion

  • Mark Hammond

    Mark Hammond - 2005-06-27

    Logged In: YES
    user_id=14198

    It looks like these interfaces are designed to be used
    early-bound. I can't find 'Caption' described in the
    typelib at all. I'm not sure how to proceed either!

     
  • Tim Johnson

    Tim Johnson - 2007-08-16

    Logged In: YES
    user_id=360594
    Originator: NO

    I get the same error when I try to create an SMS_CollectionMembershipRule object using WMI.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.