hello sirjee, i have read You solution for handling of events from CANoe in python.
I've implemented and its work correctly when I waiting in a msgbox (0, "Finished the Test", "Info", 16). I will implement it in a loop with a sleep time. The standard python function of the sleep blocks the actual task and the event handling dosn't work. Now I search for a solution to start the event class in a extra task with treahding.Thread. I've write a simple claas for testing of this: class Tester (threading.Thread): def __init__ (self, variable): threading.Thread.__init__ (self) self.__debug = True self.__env_event = None self.__appl = win32com.client.Dispatch ('CANoe.Application') self.__env = self.__appl.Environment self.__var_name = variable self.__var = self.__env.GetVariable (variable) def run (self): if self.__var != None: self.__env_event = win32com.client.WithEvents (self.__var, Tester) print 'run' i = 0 while True: pass time.sleep (10) print i i = i + 1 def OnChange (self, value): if self._debug: print ('VariableEvents:OnChange now called with %s' %value) a = Tester ('dummy') a.start () The run() dosn't work. I can't register the COM event. Have You a solution for this? The claas tester works without self.__env_event = win32com.client.WithEvents (self.__var, Tester). Regards, Bernd
-- https://mail.python.org/mailman/listinfo/python-list