Python as an extension language

Discussion in 'Python' started by Torsten Bronger, Mar 6, 2006.

  1. 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
     
    Torsten Bronger, Mar 6, 2006
    #1
    1. Advertising

  2. 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
     
    Sybren Stuvel, Mar 6, 2006
    #2
    1. Advertising

  3. Hallöchen!

    Sybren Stuvel <> 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
     
    Torsten Bronger, Mar 6, 2006
    #3
  4. Torsten Bronger

    Miki Tebeka Guest

    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/theller/moin.cgi/ShippingEmbedded

    HTH
    --
    ------------------------------------------------------------------------
    Miki Tebeka <>
    http://tebeka.bizhat.com
    The only difference between children and adults is the price of the toys
     
    Miki Tebeka, Mar 6, 2006
    #4
  5. Torsten Bronger

    James Stroud Guest

    Torsten Bronger wrote:
    > Hallöchen!
    >
    > Sybren Stuvel <> 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/
     
    James Stroud, Mar 6, 2006
    #5
  6. On Mon, 06 Mar 2006 12:20:32 +0100
    Torsten Bronger <-aachen.de> wrote:
    > Sybren Stuvel <>
    > 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 ()
    Anansi Spaceworks http://www.AnansiSpaceworks.com
     
    Terry Hancock, Mar 6, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anand
    Replies:
    3
    Views:
    903
    Tim Daneliuk
    Nov 8, 2003
  2. Christian Seberino
    Replies:
    3
    Views:
    1,191
    Christian Seberino
    Feb 5, 2004
  3. Jelle Feringa // EZCT / Paris

    OCAMl a more natural extension language for python?

    Jelle Feringa // EZCT / Paris, Jan 17, 2005, in forum: Python
    Replies:
    4
    Views:
    498
  4. Steve
    Replies:
    3
    Views:
    27,004
    Steve
    Aug 25, 2006
  5. Petr Prikryl
    Replies:
    1
    Views:
    324
    John Roth
    Nov 30, 2006
Loading...

Share This Page