[python-win32] com, CreateObject, and py2exe
Bill Purcell
william at whpiv.net
Thu Feb 24 03:05:33 CET 2011
On 240211-12:29, Mark Hammond wrote:
> I think there might be a misconception here - the if
> name=='__main__' block is *only* doing registration and
> unregistration - the COM object is not running in that process.
> Excel will be loading the COM object in-process and manage its
> lifetime itself. There really isn't a need to have your main block
> like that - you can just register it once and leave it registered
> until explicitly unregistered.
Yes. I guess I didn't realize that the process isn't tied to that
terminal/console instance. I am use to doing something like 'myprogram
&' in a bash terminal, and the myprogram process is dependent on the
console process.
> What should happen is that py2exe will create a DLL (and possibly a
> .exe) for you - but similarly to as mentioned above, this DLL is
> loaded by excel automatically - you just register it once (probably
> via regsvr32.exe) and Excel can then use it as necessary.
If I can get out of my own way and get through the learning curve
maybe I can get these results... :)
> Check out the win32com\Demos directory - but AFAIK, the excel
> samples there haven't been tested with recent versions of excel.
I will try this tomorrow on my work PC and see if things don't go
better.
By the way, I look forward to reading your book. It should be here
this week.
Regards,
Bill
More information about the python-win32
mailing list