[python-win32] threading in python

john taylor x12345jp at yahoo.com.hk
Tue Jun 28 11:36:30 CEST 2005


hi, 

anybody has called two VIs in parallel?? 

somehow like this: 
*****************************************
import win32com.client 
import thread 

lv = win32com.client.Dispatch("LabVIEW.Application") 

def start(): 
    vi2 = lv.GetVIReference("p2.vi") 
    vi2.Run() 

thr = thread.start_new_thread(start, ()) 

vi1 = lv.GetVIReference("p1.vi") 
vi1.Run() 

*****************************************

it doesn't work. i've tried calling functions of usual
objects in several threads like this and everything
was fine. but in this case, there must be sth to take
care of between COM objects and python. 

i've also tried the following: 
1. construct two lv objects in the main thread. 
2. construct lv objects in the main and the new
threads respectively. 
3. construct two vi objects in the main thread. 
4. pass lv or vi as argument when calling new thread. 
none of them works.  

anybody can help? 

cheers, 
john



More information about the Python-win32 mailing list