[Tutor] Add metadata to a dir of files.

Tim Golden mail at timgolden.me.uk
Thu Feb 22 22:01:38 CET 2007

Mark Bystry wrote:
> Well that's awesome. Thanks for the code. Unfortunately I cannot get it to run. After I installed 
> the win32 extensions for python...I get this error when trying to run.
> Traceback (most recent call last):
>    File "C:\test.py", line 4, in <module>
>      props.SummaryProperties.Category = "CAT69"
>    File "C:\Program Files\Python25\Lib\site-packages\win32com\client\dynamic.py", line 534, in 
> __setattr__
>      self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value)
> com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024891), None)
> code:
> import win32com.client
> props = win32com.client.Dispatch ("DSOFile.OleDocumentProperties")
> props.Open (r"C:\test.txt")
> props.SummaryProperties.Category = "CAT69"
> props.Save ()
> Maybe this is the same com error that you're getting

Slightly bizarrely, it works fine for me on a different
computer (my laptop). Both are Win2K. The only help I
could find on the error code suggested a permission issue,
which isn't likely. That said, I have experienced a few
funnies with the Python script writing the new Category
open in one window, and trying to use Explorer to update
the Summary info in another.

Might be worth making sure nothing else is blocking, and
giving it another go. I'll try it on a random collection
of files to see if it runs...


More information about the Tutor mailing list