[python-win32] Calling an OLE Automation (IDispatch) server which uses "out params"
Mark Hammond
mhammond at skippinet.com.au
Tue Dec 18 23:16:31 CET 2012
That's very strange - is it possible you changed the source code since
you sent it, or aren't using the latest pywin32?
This is what I see:
Python 2.7.3+ (default, May 12 2012, 13:50:02) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32com.client
>>> klass=win32com.client.gencache.GetClassForProgID("MyApp.Application")
>>> klass
<class win32com.gen_py.3D28B651-27E2-4057-A0AF-1D761C2D10CCx0x1x0.MyApp
at 0x02506960>
>>> x = klass()
>>> x.ShowMessage("Hello, world")
>>> x.SetSettingValue("color","blue")
>>> x.GetSettingValue("color")
u'color=testValue123'
>>>
Given the source code, that last line is expected (ie, every value will
return 'testValue123').
I'm at a bit of a loss on the problem you are seeing.
Mark
On 19/12/2012 1:10 AM, Dave Calkins wrote:
> On 12/17/2012 8:25 PM, Mark Hammond wrote:
>> So after running makepy, a work-around is:
>>
>> >>> klass=win32com.client.gencache.GetClassForProgID("MyApp.Application")
>> >>> x = klass()
>> >>> x.GetSettingValue("foo")
>> u'foo=testValue123'
>> >>>
>>
>
> I tried the work-around. I've run MakePy and then gave the above a
> try. The first 2 methods worked, but I'm still getting an error on the
> last method. I suspect I'm doing something wrong on my end, but am not
> sure what.
>
> =====
> Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import win32com.client
> >>> klass=win32com.client.gencache.GetClassForProgID("MyApp.Application")
> >>> klass
> <class win32com.gen_py.3D28B651-27E2-4057-A0AF-1D761C2D10CCx0x1x0.MyApp
> at 0x02374D18>
> >>> x = klass()
> >>> x.ShowMessage("Hello, world")
> >>> x.SetSettingValue("color","blue")
> >>> x.GetSettingValue("color")
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "C:\Python27\lib\site-packages\win32com\gen_py\3D28B651-27E2-4057-A0AF-1D761C2D10CCx0x1x0.py"
>
> , line 34, in GetSettingValue
> , settingValue)
> pywintypes.com_error: (-2147352571, 'Type mismatch.', None, 2)
> =====
>
>
More information about the python-win32
mailing list