John wrote:
I realize that some may consider this an advance question. But there are many here that are advance. So I'm hoping some nice soul will help me.

I'm attempting to use a OCX designed to talk with QuickBooks. I'm using win32com for the first time and have discovered an issue that I'm sure others have run into. But researching google etc. has not helped.

obj = win32com.client.Dispatch("InQB.Invoice.1")
#In the VB code #obj.ItemName(0) = 'string' #in python I'm trying obj.ItemName[0] = 'string'

Try:

obj.ItemName.Item[0] = 'string'

In VB obj.ItemName(0) = 'string' Item is the "default" property.
obj.ItemName.Item(0) = 'string' will also work in VB


#error is "Instancemethod object does not support item assignment"

I found and ran makepy.py and here is the code it created dealing with my obj.

# The method ItemName is actually a property, but must be used as a method
to correctly pass the arguments
def ItemName(self, ItemIndex=defaultNamedNotOptArg):
        """Line item property: Reference to the kind of item."""
        # Result is a Unicode object
return self._oleobj_.InvokeTypes(19, LCID, 2, (8, 0), ((3,1),),ItemIndex )

As I read the above code it can only return a string not assign anything. I'm not sure what "InvokeTypes" does.

So the question is how can I get around this issue? I'm sure others need to set properties in com objects.

BTW does anyone know of a win32com forum or list?

There is python-wi...@python.org

--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to