[python-win32] translating VB into Python...
Mark Hammond
mhammond at skippinet.com.au
Wed May 16 14:06:47 CEST 2007
> I'm hoping that Mark Hammond will catch sight
> of this thread and chip in. I'm guessing that
> you're seeing some odd interaction between
> the generated class/module and the COM object
> properties. There's a sort of funniness where
> properties can be methods... or not.
I'm stumped too.
>
> Have you generated a proxy module for this?
> If you haven't use makepy or EnsureDispatch
> to generate and then look for the definition
> of the result of the .Field method or
> property or whatever.
>
> I'm groping in the dark a little, but I suspect
> that the __str__ and __unicode__ magic methods
> of whatever type that is are actually invoking
> the default method/property of the underlying
> object.
This is 1/2 correct - 'print' or 'str' of a COM object will try a default
method, but this isn't the problem here best I can tell:
>From before:
>>> mybug.Field("BG_DESCRIPTION").Value = "123"
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > AttributeError: 'unicode' object has no attribute 'Value'
printing repr(mybug) before the above line would be interesting tho, just to
make sure it is a makepy object - if it wasn't I could see it happening in
edge cases (ie, the code around ERRORS_BAD_CONTEXT in
win32com.client.dynamic)
Mark
More information about the Python-win32
mailing list