Embedding Python in C++

Discussion in 'Python' started by Tonio, Apr 26, 2004.

  1. Tonio

    Tonio Guest

    Hi
    i'm a italian student.
    I must create a virtual machine which call python script from Visual C++
    program.
    My teacher tell me use swig fror make this work.
    I use Swig for import in Python class, object, variables of C++, but my
    problem are when in C++ i must call script Python.
    I find many article, but i don't find a working example.
    Can you advise me how i call python script from C++?
    Have you example which can you send me (in my email)?
    (my script use only int, float, string and object, class).
    Thanks.
     
    Tonio, Apr 26, 2004
    #1
    1. Advertising

  2. Ciao,

    I have some examples from my PyCon presentation here:

    http://elmer.sourceforge.net/PyCon04/elmer_pycon04.html

    ...and here is the complete example code:

    http://elmer.sourceforge.net/PyCon04/Elmer_PyCon04.tgz

    I think the example code from example 1 may be most relevant. You
    can also use Elmer (http://elmer.sourceforge.net) to generate a C
    interface to your Python code (as shown in examples 2 & 3).

    Buona fortuna!
    Rick.

    Tonio wrote:
    > Hi
    > i'm a italian student.
    > I must create a virtual machine which call python script from Visual C++
    > program.
    > My teacher tell me use swig fror make this work.
    > I use Swig for import in Python class, object, variables of C++, but my
    > problem are when in C++ i must call script Python.
    > I find many article, but i don't find a working example.
    > Can you advise me how i call python script from C++?
    > Have you example which can you send me (in my email)?
    > (my script use only int, float, string and object, class).
    > Thanks.
    >
    >
     
    Rick L. Ratzel, Apr 27, 2004
    #2
    1. Advertising

  3. uuid generator

    ( sending it again )

    Hello,
    I need to read newly generated uuid from Python
    but I am not sure if
    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/163604

    is the right code

    Maybe there is already the library in Python 2.3

    Maybe I can use the one generated with
    uuidgen
    under cygwin
    but this would not be portable

    In this last case I would like to know how can I capture the output of
    uuidgen
    so I can use it in my script

    Thank you if you know the answer !

    Cheers,
    Marcello
     
    Marcello Pietrobon, Apr 29, 2004
    #3
  4. Tonio

    Lars Heuer Guest

    Re: uuid generator

    Hi Marcello,

    > Maybe there is already the library in Python 2.3


    I believe the OSAFoundation has something like an UUID generator for
    Python in C. http://osafoundation.org/

    I'm afraid you've to download Chandler to get it.

    HTH,
    Lars
     
    Lars Heuer, Apr 29, 2004
    #4
    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. Darryl

    Embedding Python in Python

    Darryl, Oct 8, 2003, in forum: Python
    Replies:
    6
    Views:
    400
    Darryl
    Oct 14, 2003
  2. Phil Frost

    Embedding Python in Python

    Phil Frost, Aug 18, 2004, in forum: Python
    Replies:
    23
    Views:
    772
    Paul Rubin
    Aug 19, 2004
  3. Maurice LING

    embedding python in python

    Maurice LING, Sep 29, 2004, in forum: Python
    Replies:
    8
    Views:
    385
    Jeff Shannon
    Oct 1, 2004
  4. Kakacek
    Replies:
    1
    Views:
    382
    Kakacek
    Jan 12, 2006
  5. abhinav
    Replies:
    1
    Views:
    439
    Armin Steinhoff
    Feb 19, 2006
Loading...

Share This Page