[python-win32] Embedding/bundling Python, best practices?

Tim Roberts timr at probo.com
Fri Jan 25 19:12:45 CET 2008


Arve Knudsen wrote:
> We're planning to embed Python in our application, which mainly runs
> on Windows. To avoid dependencies, we want to bundle Python. Do any of
> you know of any resources on the Web describing best practices for
> bundling Python with an application, particularly on Windows? I have
> googled a bit, but most advice I found was to extend Python instead of
> embedding it, which wasn't very helpful :)
>   

This is not really that hard to do.  The Python interpreter lives in a 
DLL (python25.dll).  You just need to call it like any other Windows 
DLL.  You have the issue of providing any plugin modules that you need.

There's a tendency to think that the work is all done in python.exe, 
which would make it difficult to integrate with other applications, but 
that's not the case.  Python.exe contains less than 900 bytes of 
executable code.  (The whole exe is less than 5k!)  It does very little 
other than load python25.dll and call it.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list