[Distutils] Embedding C with Python

Thomas Heller theller at python.net
Thu Dec 2 17:09:34 CET 2004


Terry Ware <terry.ware at baesystems.com> writes:

> I work on windows platforms and I have a collection of C routines that
> are distributed via a DLL. These routines have embedded python calls.
> Currently I have to distribute the python modules separately from the
> C DLL.  Is there a way using distutils for me to combine the python
> scripts with the C code in the C DLL so that all I have to distribute
> is my C DLL along with the pythonxx.dll?

You could create a zipfile from the modules you need, and append the
zipfile to your C dll.  Then, add the pathname of your dll to sys.path
somewhere in your init code, and zipimport should do the trick.  At
least in principle ;-)

Thomas



More information about the Distutils-SIG mailing list