views:

53

answers:

2

Currently I deploy a full python distribution (the original python 2.7 msi) with my app.

Is a embebed web server, made with delphi.

Reading http://www.python-forum.org/pythonforum/viewtopic.php?f=1&t=18623 I wonder if is possible to use this for embed the necessary python files with my app, to decrease load files and avoid conflict with several python versions.

I have previous experience with python for delphi so I only need to know if only shipping the python dll + zip with the distro + own scripts will work (and if exist any caveats I must know or a sample where I can look)

+1  A: 

I think it will work fine, try it.

Nathan
A: 

zipimport should work just fine for you -- I'm not familiar with Python for Delphi, but I doubt it disables that functionality (an embedding application can do that, but it's an unusual choice). Just remember that what you can zip up and import directly are the Python-coded modules (or just their corresponding .pyc or .pyo byte codes) -- DLLs (even if renamed as .pyds;-) need to be on disk to be loaded (so if you have a zipfile with them it will need to be unzipped at the start of the app, e.g. into a temporary directory).

Moreover, you don't even need to zip up all modules, just those you actually need (by transitive closure) -- and you can easily find out exactly which modules those are, with the modulefinder module of the standard Python library. The example on the documentation page I just pointed to should clarify things. Happy zipping!

Alex Martelli