Py2Exe and a simple COM Windows Program (can't import pythoncom)

Kent Hsu (Hsu, Chih-Peng) cphsu at zen.com.tw
Fri Jan 9 06:24:31 EST 2004


Just include the 'pythoncom23.dll'. (usally can be found in
%windir%/system32 -> Windows 2000).

Best Regards,
Kent Hsu

Brian Hlubocky <hlubocky at uiuc.edu> wrote in message
news:982e9537.0401071249.4d75c8fb at posting.google.com...
> I'm have a fairly simple (in terms of COM) python program that pulls
> info from an Access database and creates Outlook contacts from that
> information. It uses wxPython for gui and works without problems.
>
> I want to be able to distribute this program using py2exe, but I am
> having some problems. I am using a simple setup.py like in the
> documentation for the py2exe tool and everything compiles ok, except
> that when I run the exe, I get an exception that says "ImportError: no
> module named pythoncom." My program used win32com (which appears to be
> loaded fine with the executable) until I needed thread support for the
> gui. In order to do this, I needed to import pythoncom and call
> CoInitialize() and CoUninitialize() manually for the new thread. I
> believe it is this use of the pythoncom module that py2exe is having
> trouble with.
>
> I tried adding "pythoncom" to the import list in the distutils
> setup.py but the py2exe tool gave me a warning that said it couldn't
> be located. I am able to import this module just fine in python
> scripts and at the interpreter. I am relatively new to COM and its use
> with python as well as with distutils and py2exe. If anyone could help
> me out with this, it would be greatly appreciated!
>
> Thanks,
> Brian





More information about the Python-list mailing list