[python-win32] Exception setting a string using COM
Tim Roberts
timr at probo.com
Sat May 31 02:31:15 CEST 2008
Aleksandr VLADIMIRSKIY wrote:
> I'm attempting to set a string value using a COM interface to an application. I get the following traceback. Could anyone help me understand the nature of the error or how I might begin to discover it?
> ...
>
> In [11]: item.Path = ""
> ---------------------------------------------------------------------------
> pywintypes.com_error Traceback (most recent call last)
>
> C:\<ipython console>
>
> c:\python24\lib\site-packages\win32com\client\__init__.py in __setattr__(self, attr, value)
> 461 except KeyError:
> 462 raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr)
> --> 463 self._oleobj_.Invoke(*(args + (value,) + defArgs))
> 464 def _get_good_single_object_(self, obj, obUserName=None, resultCLSID=None):
> 465 return _get_good_single_object_(obj, obUserName, resultCLSID)
>
> com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
>
-2147467259 is 80004005, which is the rather unhelpful E_FAIL.
Sometimes, when it is mapping a settable/gettable property, the Python
COM mapper creates a separate method for setting. You might try:
item.setPath( "" )
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list