COM Servers in python 2.3 [win32all build 157]?

Brent Turner brent.turner at clarisay.com
Mon Sep 29 16:35:51 EDT 2003


Under python 2.2 [win32all build 156]  I was able to create a COM
object in an exe much of the same way that I could from py source...
meaning that I was able to register the com server and create an
instance using the current process (exe/source) as the com server. 
Now, in python 2.3 [win32all build 157] when I try to create the COM
instance from the exe, it starts up a new process and fails (b/c my
exe does not support the command line parameters)

The Source below is what is run from inside the exe.  This may not be
the way I was supposed to do it, but at the time I found that this
worked.  Does anybody know what I am doing wrong?? or why it worked in
the first place (if it is wrong).

Source:
######################################################################
# place all com classes here to be registered at import
comservers = [ PythonCollection ]


import win32com.server.register 
import pythoncom
import sys
if hasattr(sys, 'importers'):
# we are running as py2exe-packed executable
	sys.frozen = 1
	pythoncom.frozen = 1

# Register all the comservers
for com in comservers:
	print 'Registering COM Server %s ...' % com 
	win32com.server.register.UseCommandLine(com)
######################################################################


Thanks,
Brent




More information about the Python-list mailing list