How to distribute Python COM applications?
Gordon McMillan
gmcm at hypernet.com
Sun May 20 22:07:36 EDT 2001
hungjunglu at yahoo.com wrote in <mailman.990048145.9953.python-
list at python.org>:
>I have asked Mark Hammond, but no clear answers, yet. (He told me to
>look into regsvr32.)
>
>I am also starting to look at all installation aspects of Python COM.
>(registry items, DLLs, etc.) If I succeed, I'll let people know.
>
>So far I have succeeded in distributing Python COM client
>applications.
>
>It's the Python COM server part that is complicated. I know py2exe or
>Gordon installer are not enough, but besides that, more registry
>tweaking and DLL handling are needed.
Actually, it's more a problem with the arrangement of responsibilities.
Your typical Python COM server defines a class and has some register /
unregister logic under the "if __name__ == '__main__':" code. So it's both
a script (when registering / unregistering) and a module (when attached
through COM). If you just freeze your class, all you'll get is the register
/ unregister code, and it won't create the right entries.
There *is* a script which runs (when you use out-of-process): it's
win32com/server/localserver.py. As proof of concept, I hacked up
localserver.py so that I got localserver.exe which could serve up my COM
class. By manually tweaking the registry, I got it working (out-of-
process). So I know this stuff is possible, it's just that generalizing and
automating it is a considerable amount of work.
[And I'm not sure that in-process is possible, mainly because with in-
process I don't think I have enough control over installation and search
paths.]
- Gordon
More information about the Python-list
mailing list