473,396 Members | 2,115 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,396 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 2815
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.