473,405 Members | 2,210 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,405 software developers and data experts.

Problem with COM and threads -- urgent

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,i*e)
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 17 '06 #1
1 1138
bartonc
6,596 Expert 4TB
obj = GenericFunctions()
obj.func(dest) # this is gving an error.
Teja.P
do mean:

obj.MyNavigate(dest)

?
Oct 17 '06 #2

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

Similar topics

4
by: Sachin Jagtap | last post by:
Hi, I am getting exception while poping item from queue, I am writing messages coming from client in a queue in one thread and then in other thread i am reading from queue and writing in file....
34
by: Kovan Akrei | last post by:
Hi, I would like to know how to reuse an object of a thread (if it is possible) in Csharp? I have the following program: using System; using System.Threading; using System.Collections; ...
28
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
6
by: Carlos Lozano | last post by:
Hi, I have the following problem. I created a Properties section: private SerialComm oComm = new SerialComm(); // Wraps a DLL to handle Serial //comms. private Thread PrinterThread = null;...
0
by: Mamatha | last post by:
Hi I have application in VB.NET,In that application threads are created dynamically and displays URLs of a webpage in the listview.At the time of running each thread their URL values are stored...
1
by: Mamatha | last post by:
Hi friends, I have an application using mutithreads.In that application one threads writes the data in to a file. Another thread reads the data from same file. So some errors while at the time...
1
by: Mamatha | last post by:
Hi I have one application in VB.NET using mutiple threads. While that application running,threads get some data and placed it into a file.That same file is used contineously by another threads...
4
by: Adrian Parker | last post by:
We've suddenly started getting a problem with a call to clear the contents of a DataTable. This is on a live customer site that's been working fine until yesterday. As far as we know they've not...
4
by: Al Norman | last post by:
We have two separate DLLs that do not interact (directly, at least). One is an MFC extension DLL that was built back in VC++ 6 days (but has been recompiled with VS2005). The other is a DLL that...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.