473,394 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Python as an extension language

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
5 1347
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Irmen de Jong | last post by:
QOTW: "Confronting the Martellibot is like flirting with an encyclopedia, I'd rather not do it myself, but I respect those who do, because it produces knowledge." -- Anton...
226
by: Stephen C. Waterbury | last post by:
This seems like it ought to work, according to the description of reduce(), but it doesn't. Is this a bug, or am I missing something? Python 2.3.2 (#1, Oct 20 2003, 01:04:35) on linux2 Type...
18
by: K_Lee | last post by:
I documented the regex internal implementation code for both Tcl and Python. As much as I like Tcl, I like Python's code much more. Tcl's Stub interface to the external commands is confusing to...
3
by: Matthias Baas | last post by:
Hi, are there any guidelines about what to do if a Windows extension for Python 2.4 requires the C++ runtime (msvcp71.dll)? If I want to distribute a binary installer of an extension that...
0
by: Cameron Laird | last post by:
QOTW: "Really, of course, the only things you need to make explicit are the ones that readers don't understand." -- Steve Holden "Working with unicode objects in Python is so transparent, it's...
13
by: Roger Erens | last post by:
Hello, I remember that the first time I read about Python as a programming language was when reading the W3C's HTML 4.01 specification a few years ago. In the section on objects, images and...
2
by: robert | last post by:
When employing complex UI libs (wx, win32ui, ..) and other extension libs, nice "only Python stack traces" remain a myth. Currently I'm hunting again a rare C-level crash bug of a Python based...
1
by: Petr Prikryl | last post by:
Do you think that the following could became PEP (pre PEP). Please, read it, comment it, reformulate it,... Abstract Introduction of the mechanism for language extensions via modules...
16
by: per9000 | last post by:
Hi, I recently started working a lot more in python than I have done in the past. And I discovered something that totally removed the pretty pink clouds of beautifulness that had surrounded my...
206
by: WaterWalk | last post by:
I've just read an article "Building Robust System" by Gerald Jay Sussman. The article is here: http://swiss.csail.mit.edu/classes/symbolic/spring07/readings/robust-systems.pdf In it there is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.