Problem setting COM property using win32com
Green, Gregory P
gregory.p.green at boeing.com
Mon Apr 7 11:53:49 EDT 2003
I am creating the object like so:
attrs = win32com.client.Dispatch("SmRecList.SmRecordList")
I hadn't noticed the dynamic. I guess I can try to force early binding.
-----Original Message-----
From: Paul Prescod [mailto:paul at prescod.net]
Sent: Monday, April 07, 2003 12:17 AM
To: Green, Gregory P
Cc: python-list at python.org
Subject: Re: Problem setting COM property using win32com
I don't claim to be a win32com expert but I notice two things in your
message that made me suspicious.
Greg Green wrote:
> I have a commercial com api that I'm trying to use with python. I am
> trying to set a property of the com object. The property is called
> Value, and I know enough to use the SetValue function. But that
> doesn't work.
>
> Here is the code:
> attrs.SetValue("CN_ID", 0, "0000005")
>
> Here is the error:
> Traceback (most recent call last):
> File "example.py", line 49, in ?
> prmidattrs.SetValue("CN_ID", 0, "0000005")
> File "C:\PYTHON22\lib\site-packages\win32com\client\dynamic.py", line 438, in __getattr__
> raise AttributeError, "%s.%s" % (self._username_, attr)
> AttributeError: SmRecList.SmRecordList.SetValue
>
> If I look at the makepy generated module, I see the method.
Why are you getting an exception in "dynamic.py" if you are using "makepy"?
How are you creating the prmidattrs object?
Paul Prescod
More information about the Python-list
mailing list