[python-win32] translating VB into Python...

Michael March mmarch at gmail.com
Tue May 15 01:22:24 CEST 2007


> Michael March wrote:
> > I have some sample code with this:
> >
> >    object.Field("UserDefined_01") = "Open"
> >
> > Python barfs on that.. what would be the equivalent of that in Python?
> >
>
> Usually:
>     object.Field("UserDefined_01").Value = "Open"
>
> VB has the concept of a "default property" for a collection like this.
> Python's COM doesn't.  Unfortunately, every object has it's own "default
> property", so you sometimes have to refer to documentation to figure out
> what it is.

When you do:

    object.Field("UserDefined_01")

... the output is a unicode object..  So putting:

   object.Field("UserDefined_01").Value

.. barfs..

I'm obviously missing something here..

Thanks!


More information about the Python-win32 mailing list