Hi,
Found the reason. The COM component in this case somehow depends on the windows
message pump.
while FlagToStop == False :
win32gui.PumpMessages();
Solved the issue.
Marcus.
----- Original Message -----
From: Marcus Low
To: 'Python-Win32 List'
Sent: Monday, March 31, 2008 4:48 PM
Subject: [python-win32] Threads in COM not given time to execute?
Hi,
I am testing a COM component, when i execute it under pythonwin idle and
single stepping F10 to "SmtpMail.Start()" :
SmtpMail = win32com.client.Dispatch("SomeSMTPCom")
SmtpMail.Start()
I can telnet to 127.0.0.1 25 and get a proper SMTP response
But when i run the program it just quits so i am assuming SmtpMail.Start()
does not block. So i added a function to wait for an event
before allowing the function to quit to that SmtpMail.Start() can run as long
as it want :-
def MainEntry () :
global FlagToStop
SmtpMail = win32com.client.Dispatch("SomeSMTPCom")
SmtpMail.Start()
thread.start_new(CheckForQuit,(0,))
while FlagToStop == False :
win32api.Sleep(1000) # i tried os.sleep(0), pass but the uses
50% of cpu
SmtpMail.Stop()
i have confirmed that the it will loop in "While FlagToStop ..." however when
i telnet 127.0.0.1 25, it gets connected but i don't get a reply from the COM
which
is a STMP component. I can get a response if i use single step to where
".Start()" but if i just run the program i get this feeling that the COM object
here doesnt
get the time to execute and thus could not respond.
Am i missing out some basic steps here?
Marcus.
------------------------------------------------------------------------------
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32