Problems importing _sre w/VC7-compiled Python 2.1

David Aldridge daldridge at austin.rr.com
Sun May 19 08:33:00 EDT 2002


Sorry if this gets double posted -- RoadRunner puked on my sending
earlier, so it's straight-to-Google time!

Anyway, your suggestions were spot on (and so obvious that I should
slap myself...)  Using dumpbin showed that all of the modules I
compiled contained *NO* exports.  Adding an /EXPORT:<blah> setting to
the linker line "fixed" the problem, but that shouldn't be necessary,
as the appropriate functions are __declspec(dllexport).  Bizarro... 
*sigh* Guess it's time to spend a year figuring out how/why exports
are broken.  Bah, Microsoft.  Bah.

David



sjmachin at lexicon.net (John Machin) wrote in message news:<c76ff6fc.0205181617.7b529696 at posting.google.com>...
> "RoadRunner eNews" <audballio at yahoo.com> wrote in message news:<urxF8.92424$9F5.5507182 at typhoon.austin.rr.com>...
> > I've successfully built Python 2.1 with VC7, but I'm having a problem using
> > the resulting binaries, namely _sre.pyd (and _d.pyd).  Specifically, when I
> > attempt to 'import re', the result is a Traceback stating 'ImportError:
> > dynamic module does not define init function (init_sre)'.   Everything works
> > fine under VC6, and ...\modules\_sre.c definitely contains init_sre(), so it
> > has to be something VC7 related.
> > 
> 
> I'm not an MS VCn guru for any value of n. However, based on some
> trips through "DLL hell" with other compilers, here are some ideas
> that may help:
> 
> (1) Use the Dependency Walker or some other tool to examine the
> _sre.pyd itself to see that the entry point init_sre is actually there
> (and not _init_sre or something else), rather than relying on its
> presence in the source. Then you will know whether the problem is in
> the importer or the importee.
> 
> (2) If you haven't done so already, you should use the -v option when
> running Python, to display the names of the actual full paths for
> files that it is opening. However I can't recall whether you will get
> the path printed before the ImportError.
> 
> HTH,
> John



More information about the Python-list mailing list