On 12/13/2012 10:39 PM, Mark Hammond wrote:
This is the form you should use, but the method name you are trying to
call is "GetSettingValue", not "GetSettingName", hence the
AttributeError.
Mark
Ah, yes. Good catch! Unfortunately, correcting that typo didn't seem
to fix it. Here's what I get, when using the correct method name this time.
=====
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
>>> x = win32com.client.Dispatch("MyApp.Application")
>>> x.ShowMessage("Hello World")
>>> x.SetSettingValue("testName","testValue")
>>> testValue = x.GetSettingValue("testName")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<COMObject MyApp.Application>", line 2, in GetSettingValue
pywintypes.com_error: (-2147352561, 'Parameter not optional.', None, None)
=====
It appears it does want that second parameter, but passing in a variable
doesn't seem to work.
=====
>>> testValue = ""
>>> x.GetSettingValue("testName",testValue)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<COMObject MyApp.Application>", line 2, in GetSettingValue
pywintypes.com_error: (-2147352571, 'Type mismatch.', None, 2)
=====
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32