views:

119

answers:

1

Hi folks,

I have a c++ app that calls another python one (bundled into an exe with py2exe) So I have 2 apps.

So I was wondering: What if my c++ did what py2exe does? i.e. embed the python app in the c++ one. This way I won't depend on py2exe and its configurations nighmares (yes, it has some)

Hence my questions:

  • how does py2exe work (so I can do its job with my c++ app)
  • What about just embedding the whole python app with the c++? I read the python doc about embedding, did an example (a very simple one that does PyRun_SimpleString) but what about a whole python app with tons of modules? (zipimport maybe?)

I'd love to hear how you'd do that.

Thanks a lot! :)

+2  A: 

http://www.py2exe.org/index.cgi/FAQ

Basically, it packages up your python install and redistributes it. It still runs your Python as Python on a Python interpreter. The exe it creates just kicks everything off.

The Python website has some methods on integrating with C++.

Oli
Thanks @Oli, that's what I thought too. (library.zip and the Python25.dll) and a little (the same) exe that uses the dll to run the modules in the zip. Right? Can this be done easily with c++?
sandra