Py2exe and extension issues

John Machin sjmachin at lexicon.net
Mon Jan 3 14:30:23 EST 2005


kdahlhaus at yahoo.com wrote:
> Is anyone aware of issues with Py2exe and extensions compiled with
> cygwin/mingw for Python 2.3?   I have an extension that wraps access
to
> some C DLLs.  The generated executable always segfaults at startup,
> although things work fine when running through the normal python
> interpreter.  I had a guess that perhaps the issue stems from my
> extension being compiled with cygwin and py2exe compiled with  Visual
> C++?

Some questions:
1. Did it work before (e.g. with Python 2.2, or an earlier version of
py2exe), or has it never worked?
2. Where at start-up does it "segfault"? Doesn't the "Dr Watson" log
file tell you anything? You may need to sprinkle prints and printfs
around your code.
3. Those C DLLs: supplied by whom -- you or an nth party? compiled with
which compiler?
4. Which version(s) of which Windows are you using?

Some hints:
1. Ask on the py2exe mailing list.
2. Your guess may be correct. The usual cause of such a problem is
getting a run-time-library resource on one side of the chasm and trying
to use it on the other side. When the resource is a pointer to a data
structure whose contents are not defined by some standard, anything can
go wrong, and usually does. Examples: (a) malloc() on one side and
free() on the other (b) fopen() on one side and fanything() on the
other. However I would expect these problems to show up under normal
interpreter use.
3. Using py2exe instead of python may merely be exposing a bug in your
code caused by e.g. an uninitialised variable. (-: When you say "things
work fine" in normal interpreter mode, where does this lie in the
continuum between "it ran regression tests and volume tests happily all
night" and "I fired it up and it didn't fall over"? :-)

HTH,
John




More information about the Python-list mailing list