By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,369 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,369 IT Pros & Developers. It's quick & easy.

Python as an extension language

P: n/a
Hallöchen!

I'd like to use Python as an extension language for a C++ program.
I.e., the user starts my program and gives a python script, either
by file name or via stdin. The python script triggers a couple of
function calls within the C++ program, and afterwards my program
exits.

I already know how to do that in principle. My only concern is
distributing the thing, especially for the Windows platform. Is it
possible to create a bundle of my program and a light-weight Python
interpreter, so that installation is easy and disk usage relatively
small? The Python scripts are not supposed to import modules after
all, at least not explicitly.

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus ICQ 264-296-646
Mar 6 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Torsten Bronger enlightened us with:
I already know how to do that in principle. My only concern is
distributing the thing, especially for the Windows platform.


Check out distutils and py2exe.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Mar 6 '06 #2

P: n/a
Hallöchen!

Sybren Stuvel <sy*******@YOURthirdtower.com.imagination> writes:
Torsten Bronger enlightened us with:
I already know how to do that in principle. My only concern is
distributing the thing, especially for the Windows platform.


Check out distutils and py2exe.


I know that py2exe can convert a Python script into an EXE file,
however, I have no Python script. I only have C++ source code, and
I'd like to avoid saying, "well, please install my little EXE and
this 10MB Python MSI for scripting it".

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus ICQ 264-296-646
Mar 6 '06 #3

P: n/a
Hello Torsten,
I'd like to use Python as an extension language for a C++ program.
I.e., the user starts my program and gives a python script, either
by file name or via stdin. The python script triggers a couple of
function calls within the C++ program, and afterwards my program
exits.

I already know how to do that in principle. My only concern is
distributing the thing, especially for the Windows platform. Is it
possible to create a bundle of my program and a light-weight Python
interpreter, so that installation is easy and disk usage relatively
small? The Python scripts are not supposed to import modules after
all, at least not explicitly.

See http://starship.python.net/crew/thel...ippingEmbedded

HTH
--
------------------------------------------------------------------------
Miki Tebeka <mt*****@qualcomm.com>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys
Mar 6 '06 #4

P: n/a
Torsten Bronger wrote:
Hallöchen!

Sybren Stuvel <sy*******@YOURthirdtower.com.imagination> writes:

Torsten Bronger enlightened us with:

I already know how to do that in principle. My only concern is
distributing the thing, especially for the Windows platform.


Check out distutils and py2exe.

I know that py2exe can convert a Python script into an EXE file,
however, I have no Python script. I only have C++ source code, and
I'd like to avoid saying, "well, please install my little EXE and
this 10MB Python MSI for scripting it".

Tschö,
Torsten.


Even if you had 30 different things to install to make your program
work, you could bundle them into one double-clickable installer with
inno setup. Usage is very easy. Also, read the FAQ and knowledge base
entirely if you want to make pretty slick installers. Link:

http://www.jrsoftware.org/isinfo.php

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Mar 6 '06 #5

P: n/a
On Mon, 06 Mar 2006 12:20:32 +0100
Torsten Bronger <br*****@physik.rwth-aachen.de> wrote:
Sybren Stuvel <sy*******@YOURthirdtower.com.imagination>
writes:
Torsten Bronger enlightened us with:
I already know how to do that in principle. My only

concern is > distributing the thing, especially for the
Windows platform.

Check out distutils and py2exe.


I know that py2exe can convert a Python script into an EXE
file, however, I have no Python script. I only have C++
source code, and I'd like to avoid saying, "well, please
install my little EXE and this 10MB Python MSI for
scripting it".


If your C++ file is so small, then maybe you should
not embed a Python interpreter in it, but rather allow it to
be compiled as a Python module. Just write a Pyrex or Python
C/API wrapper for it, and include a build for the Python
module.

--
Terry Hancock (ha*****@AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com

Mar 7 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.