473,320 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Help needed on COM issue

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"]

In Python I need to do ..

oR=oA.Action()
print oR.Item(1,2)[0]
[returns say "1"]
oR.Update
[saves the record with the new item]

But when I ty to update the value

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

I get a TypeError : object doesn't support item assignment.

I presume this is because Python is returning oR as a tupe - hence the
need to refer to Item(1,2)[0] - but I can't figure out the equivalent
method to update the value I need.

Any help appreciated.

Apr 12 '06 #1
2 1069
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.

I presume this is because Python is returning oR as a tupe - hence the
need to refer to Item(1,2)[0] - but I can't figure out the equivalent
method to update the value I need.

Any help appreciated.

Apr 12 '06 #2
Hi,

First I'd check if the type is indeed tuple.

How about converting the tuple to a list, modifying the list, then making it
a tuple again ?

Philippe

Mike Howard wrote:
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.

I presume this is because Python is returning oR as a tupe - hence the
need to refer to Item(1,2)[0] - but I can't figure out the equivalent
method to update the value I need.

Any help appreciated.


Apr 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is...
3
by: Abhas | last post by:
> > Hi, this is Abhas, > > I had made a video library program in C++, but was facing a problem. > > After entering 12 movies, i cannot enter any more movies. > > Something gibberish comes instead....
6
by: Jamal | last post by:
I am working on binary files of struct ACTIONS I have a recursive qsort/mergesort hybrid that 1) i'm not a 100% sure works correctly 2) would like to convert to iteration Any comments or...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
15
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
2
by: Steve K | last post by:
I got a bit of a problem I like some help on. I'm designing an online training module for people that work in food processing plants. This is my target audience. These workers have little or no...
4
by: Michael Kujawa | last post by:
I am using the following to create an SQL statement using the names and values from request.form. The loop goes through each item in request.form The issue comes in having an additional "and" at...
1
by: AlmasKhan01 | last post by:
Hi I have been for sometime now been working on a MineSweeper program and I'm 90% complete on it it involves a window interface and is quite simple but the issue is not. The program is long(to me)...
3
by: NatRoger | last post by:
Hi, We are using DB2 V7 (MVS) in our shop, which dont have the luxury of the 'WITH clause' - CTE support to accomplish recursive queries. Here is my problem - Table1 From-ID To-ID A1 ...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.