468,287 Members | 1,899 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,287 developers. It's quick & easy.

COM error

What is "ValueError: argument is not a COM object" ? I get this error
when I try to pass a COM object to a thread.

Any pointers????

Thanks

Teja

Oct 14 '06 #1
2 1081
On 2006-10-14, Teja <te*********@gmail.comwrote:
What is "ValueError: argument is not a COM object" ? I get this
error when I try to pass a COM object to a thread.

Any pointers????
Try passing it to Larry Bird, instead. He's bound to score some
points.

Seriously, the function you called expected a COM object and you
passed it something else. Without seeing more code, it's hard to
be any helpfuller.

--
Neil Cerutti
Oct 14 '06 #2

Neil Cerutti wrote:
On 2006-10-14, Teja <te*********@gmail.comwrote:
What is "ValueError: argument is not a COM object" ? I get this
error when I try to pass a COM object to a thread.

Any pointers????

Try passing it to Larry Bird, instead. He's bound to score some
points.

Seriously, the function you called expected a COM object and you
passed it something else. Without seeing more code, it's hard to
be any helpfuller.

--
Neil Cerutti
HI all,

I have a problem in accesing COM objects in threads. To be precise,
lets assume that I have a class GenericFunctions which is defined as
follows:

import win32com.client, pythoncom, thread
ie=win32com.client.Dispatch('internetexplorer.appl ication')
ie.Visible=1

class GenericFunctions:

def __init__(self):
print "In Constructor of Generic Functions"

def MyNavigate(self,dest):
ie.Navigate(dest)
Now there is another file Main.py which is defined as follows:

import win32com.client, pythoncom, thread
from GenericFunctions import *
obj = GenericFunctions()

class Mainclass:
def __init__(self);
print "In Constructor of Main class"

def threadFunction(self,dest):
pythoncom.CoInitialize()
d=pythoncom.CoGetInterfaceAndReleaseStream(s,
pythoncom.IID_IDispatch)
my_ie=win32com.client.Dispatch(d)
obj.func(dest) # this is gving an error.
pythoncom.CoUninitialize()

if __name__ == "__main__":

s=pythoncom.CoMarshalInterThreadInterfaceInStream( pythoncom.IID_IDispatch,ie)
thread.start_new_thread(self.nav, (s,'www.google.com')

Basically, I want to access object of GenericFunctions class inside
threadFunction(). However I was able to execute
my_ie.Navigate("google.com"). But that was not I wanted. I am not
knowing where the error is....
Please let me know the solution ASAP...

Teja.P

Oct 16 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Gregory | last post: by
7 posts views Thread by p | last post: by
3 posts views Thread by Manuel | last post: by
1 post views Thread by developer | last post: by
reply views Thread by mchuc7719 | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.