Hello Tim, Thank you for your reply. I tried to use the setPath method and no luck:
In [26]: item.setPath('') --------------------------------------------------------------------------- exceptions.AttributeError Traceback (most recent call last) C:\coe\<ipython console> c:\python24\lib\site-packages\win32com\client\__init__.py in __getattr__(self, attr) 452 args=self._prop_map_get_.get(attr) 453 if args is None: --> 454 raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) 455 return self._ApplyTypes_(*args) 456 AttributeError: '<win32com.gen_py.Expression Media 1.0 Type Library.IMediaItem instance at 0x20535736>' object has no attribute 'setPath' I did dir(item) and there were no set/get methods, just the ones provided by the application's COM. The item.Path attribute appears to just be a unicode string. Aleksandr -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Roberts Sent: Friday, May 30, 2008 5:31 PM To: Python-Win32 List Subject: Re: [python-win32] Exception setting a string using COM 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, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32