<HTML><HEAD>
<META content="text/html; charset=UTF-8" http-equiv=Content-Type></HEAD>
<BODY dir=ltr bgColor=#ffffff text=#000000>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>
<DIV 
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none"><FONT 
size=3 face=Calibri>Hi Matteo,</FONT></DIV>
<DIV style="FONT: 10pt tahoma"><FONT size=3 face=Calibri></FONT>&nbsp;</DIV>
<DIV style="FONT: 10pt tahoma"><FONT size=3 face=Calibri>Thanks for the 
suggestions. I have integrated the win32trace module into my frozen app.&nbsp; 
Here is my final code:</FONT></DIV>
<DIV style="FONT: 10pt tahoma"><FONT size=3 face=Calibri></FONT>&nbsp;</DIV>
<DIV>from quickwho_main import quickwhoApp</DIV>
<DIV>import time</DIV>
<DIV>import tempfile</DIV>
<DIV>from win32com.server.exception import COMException</DIV>
<DIV>import winerror</DIV>
<DIV>import win32com.server.register</DIV>
<DIV>import win32traceutil</DIV>
<DIV>&nbsp;</DIV>
<DIV>import sys</DIV>
<DIV>sys.stdout = open('C:/Users/Kevin/Desktop/my_stdout.log', 'w')</DIV>
<DIV>sys.stderr = open('C:/Users/Kevin/Desktop/my_stderr.log', 'w')</DIV>
<DIV>&nbsp;</DIV>
<DIV>#expose basic functionality to COM</DIV>
<DIV>class QuickWho_Domain:</DIV>
<DIV>&nbsp; _public_methods_ = ['GetDomain']</DIV>
<DIV>&nbsp; _reg_progid_ = 'QuickWho.Application'</DIV>
<DIV>&nbsp; _reg_clsid_= '{9F825846-F10B-47DD-91E8-88DA93C1A05E}'</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; def GetDomain(self, domain):</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; app.searchfield.delete(0, 
'end')</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; app.searchfield.insert(0, 
str(domain))</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; app.getInfo()</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; time.sleep(1)</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
alltext=app.getData()</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tempfile = 
tempfile.gettempdir()+ '/urltext.txt'</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data = open(tempfile, 
'r')</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; finaltext = 
data.read()</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
data.close()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return finaltext</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except Exception ,ex:</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exMsg='Unable to 
retrieve domain data '+str(ex)</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise 
COMException(desc=exMsg,</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
scode=winerror.E_FAIL)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>print "*"*20</DIV>
<DIV>import win32com.server.register </DIV>
<DIV>sys.argv.append('--debug')</DIV>
<DIV>win32com.server.register.UseCommandLine(QuickWho_Domain)</DIV>
<DIV>print "*"*20</DIV>
<DIV>&nbsp;</DIV>
<DIV>try:</DIV>
<DIV>&nbsp;&nbsp;&nbsp; app = quickwhoApp(None)</DIV>
<DIV>&nbsp;&nbsp;&nbsp; app.mainloop()</DIV>
<DIV>except Exception ,ex:</DIV>
<DIV>&nbsp;&nbsp;&nbsp; print "error !! " + str(ex)</DIV>
<DIV>&nbsp;</DIV>
<DIV>(I put the code into a frozen app because it isn’t practical to debug the 
app itself when run as a Python module—it won’t be deployed that way.)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV style="FONT: 10pt tahoma"><FONT size=3 face=Calibri>I did get some 
debugging output, though not what I expected:</FONT></DIV>
<DIV style="FONT: 10pt tahoma"><FONT size=3 face=Calibri></FONT>&nbsp;</DIV>
<DIV>Exception in Tkinter callback</DIV>
<DIV>Traceback (most recent call last):</DIV>
<DIV>&nbsp; File "Tkinter.pyc", line 1410, in __call__</DIV>
<DIV>&nbsp; File "quickwho_main.pyc", line 159, in &lt;lambda&gt;</DIV>
<DIV>&nbsp; File "quickwho_main.pyc", line 253, in getInfo</DIV>
<DIV>&nbsp; File "subprocess.pyc", line 537, in check_output</DIV>
<DIV>&nbsp; File "subprocess.pyc", line 672, in __init__</DIV>
<DIV>&nbsp; File "subprocess.pyc", line 784, in _get_handles</DIV>
<DIV>&nbsp; File "subprocess.pyc", line 823, in _make_inheritable</DIV>
<DIV>WindowsError: [Error 6] The handle is invalid</DIV>
<DIV>&nbsp;</DIV>
<DIV>This appears to be related to the bug logged at <A 
title=http://bugs.python.org/issue3905 
href="http://bugs.python.org/issue3905">http://bugs.python.org/issue3905</A>. My 
app makes use of subprocess to obtain various bits of data that it then parses 
and displays in its UI. For what it’s worth,&nbsp; injecting the trace module 
into my frozen app causes no output to appear at all in the app itself, and 
returns the error above; the trace module seems to trigger the suprocess bug. 
However, it seems to have no bearing at all on the failure of VBScript to create 
a COM object from my application, and the debugging output logged to my 
stdout/stderr file did not yield any insight on that. </DIV>
<DIV>&nbsp;</DIV>
<DIV>I investigated whether running the mainloop() in the app might interfere 
with the application receiving the COM request from the Windows Script Host, but 
commenting out the mainloop only caused the app to crash (since Tkinter apps 
require a mainloop to run). </DIV>
<DIV>&nbsp;</DIV>
<DIV>The bottom line of all this investigation is that I am no closer to 
understanding why my Tkinter app does not respond to the CreateObject request 
from VBS. It appears that those requests simply disappear into a black hole. It 
also appears that integrating a GUI toolkit with its own event loop in Python 
may not be very practical with a COM server (see <A 
title=http://trac.wxwidgets.org/ticket/12105 
href="http://trac.wxwidgets.org/ticket/12105">http://trac.wxwidgets.org/ticket/12105</A> 
for some other issues with wxPython and COM).&nbsp; Unfortunately, this means my 
best option is probably to move ahead without COM support. </DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks again for your help.</DIV>
<DIV>&nbsp;</DIV>
<DIV>--Kevin&nbsp; </DIV></DIV></DIV></DIV></BODY></HTML>