By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,922 Members | 1,493 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,922 IT Pros & Developers. It's quick & easy.

COM and threads

P: n/a
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

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

class GenericFunctions:

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

def MyNavigate(self,dest):
Now there is another file 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):
obj.func(dest) # this is gving an error.

if __name__ == "__main__":

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

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


Oct 16 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.