Python as an extension language

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Torsten Bronger

    #1

    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
  • Sybren Stuvel

    #2
    Re: Python as an extension language

    Torsten Bronger enlightened us with:[color=blue]
    > I already know how to do that in principle. My only concern is
    > distributing the thing, especially for the Windows platform.[/color]

    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

    Comment

    • Torsten Bronger

      #3
      Re: Python as an extension language

      Hallöchen!

      Sybren Stuvel <sybrenUSE@YOUR thirdtower.com. imagination> writes:
      [color=blue]
      > Torsten Bronger enlightened us with:
      >[color=green]
      >> I already know how to do that in principle. My only concern is
      >> distributing the thing, especially for the Windows platform.[/color]
      >
      > Check out distutils and py2exe.[/color]

      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

      Comment

      • Miki Tebeka

        #4
        Re: Python as an extension language

        Hello Torsten,
        [color=blue]
        > 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.[/color]
        See http://starship.python.net/crew/thel...ippingEmbedded

        HTH
        --
        ------------------------------------------------------------------------
        Miki Tebeka <mtebeka@qualco mm.com>

        The only difference between children and adults is the price of the toys

        Comment

        • James Stroud

          #5
          Re: Python as an extension language

          Torsten Bronger wrote:[color=blue]
          > Hallöchen!
          >
          > Sybren Stuvel <sybrenUSE@YOUR thirdtower.com. imagination> writes:
          >
          >[color=green]
          >>Torsten Bronger enlightened us with:
          >>
          >>[color=darkred]
          >>>I already know how to do that in principle. My only concern is
          >>>distributi ng the thing, especially for the Windows platform.[/color]
          >>
          >>Check out distutils and py2exe.[/color]
          >
          >
          > 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.
          >[/color]

          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:



          James

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


          Comment

          • Terry Hancock

            #6
            Re: Python as an extension language

            On Mon, 06 Mar 2006 12:20:32 +0100
            Torsten Bronger <bronger@physik .rwth-aachen.de> wrote:[color=blue]
            > Sybren Stuvel <sybrenUSE@YOUR thirdtower.com. imagination>
            > writes:[color=green]
            > > Torsten Bronger enlightened us with:[color=darkred]
            > >> I already know how to do that in principle. My only[/color]
            > >concern is > distributing the thing, especially for the
            > >Windows platform.
            > >
            > > Check out distutils and py2exe.[/color]
            >
            > 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".[/color]

            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 (hancock@Anansi Spaceworks.com)
            Anansi Spaceworks http://www.AnansiSpaceworks.com

            Comment

            Working...