Help needed on COM issue

Tim Golden tim.golden at viacom-outdoor.co.uk
Wed Apr 12 03:41:44 EDT 2006


[Mike Howard]

| Should read ...
| I'm doing some conversion of vb code to python code and I have a
| problem with a COM object
| 
| Specifically in VB I can do
| Set oR = oA.Action
| debug.print oR.Item(1,2)
|  [returns say "1"]
| oR.Item(1,2)="4"
| debug.print oR
|  [returns "4"]
| oR.Update
|  [saves the record with the new item]
| 
| In Python I need to do ..
| 
| oR=oA.Action()
| print oR.Item(1,2)[0]
|  [returns say "1"]
| 
| But when I ty to update the value
| 
| oR.Item(1,2)[0]="4"
| 
| I get a TypeError : object doesn't support item assignment.

You sometimes find that altho' VB lets you shortcut attribute
value and assignment, it's actually doing a .Value= 
behind-the-scenes. (At least, I seem to remember coming across that).

So try something like:

oR.Item(1, 2)[0].Value = "4"

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list