473,325 Members | 2,608 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,325 software developers and data experts.

Embedding Python in C++

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.
Jul 18 '05 #1
3 2811
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.


Jul 18 '05 #2
( sending it again )

Hello,
I need to read newly generated uuid from Python
but I am not sure if
http://aspn.activestate.com/ASPN/Coo.../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

Jul 18 '05 #3
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
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jordi | last post by:
Hi, I'm starting to use Python embedded in a C program. I'm using Python to execute several scripts using as a variables information retrieved for several multithread "agents" written in C. ...
0
by: Atul Kshirsagar | last post by:
I am embedding python in my C++ application. I am using Python *2.3.2* with a C++ extention DLL in multi-threaded environment. I am using SWIG-1.3.19 to generate C++ to Python interface. Now to...
23
by: Robey Holderith | last post by:
Anyone know a good way to embed python within python? Now before you tell me that's silly, let me explain what I'd like to do. I'd like to allow user-defined scriptable objects. I'd like to...
4
by: Alicia Haumann | last post by:
I accidentally sent this to webmaster@python.org, so this could be a duplicate if "webmaster" forwards it to this list. :{ Hi, there. Thanks for any help that can be offered. I've been...
1
by: Martin | last post by:
Greetings, I am new to python and wish to embed python in an 3D graphics application to provide application automation. The high level goal is to be able to drive my app from a script for batch...
2
by: Roose | last post by:
With some googling I have found these resources: http://docs.python.org/ext/win-dlls.html http://www.python.org/doc/faq/windows.html I have a large Win32/MFC/C/C++ application that has an...
1
by: amit | last post by:
Hello, I am currently studying how to embedd python. I am developing a graphical C++ application. My goal is to embedd python script that will control some kind of animation. I have some...
1
by: Tommy Nordgren | last post by:
I want to write an application that embeds and extends (at least) the Python and Perl interpreters. Now i want to find as much as possible about the Python tools used for extending and embedding...
6
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python...
0
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.