473,385 Members | 1,317 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,385 software developers and data experts.

Good examples for Embedding python in C, C++

Hallo

I am looking for good examples on how to call a python script from C,
C++ and pass parameters (list of strings) to the python script. The
aim is to ultimately allow the end-user to modify the python script,
without any code recompilation, to suit the needs of the end-user.
The C, C++ part will remain intact.

I could not find good examples, that could help me with this, in the
references from python.org. I would appreciate your help.

thanks
Henko

Jul 18 '05 #1
1 2371

I did a presentation on this very topic at PyCon this year:

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

...and here is the complete example code:

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

You can use Elmer (http://elmer.sourceforge.net) to automatically
generate the C equivalent to a Python API. When run in "frozen" mode,
the resulting application is self-contained...but when run in "warm"
mode, a user can modify the python sources without any code
recompilation, like you said.

-Rick Ratzel

Henko Gouws (H) wrote:
Hallo

I am looking for good examples on how to call a python script from C,
C++ and pass parameters (list of strings) to the python script. The
aim is to ultimately allow the end-user to modify the python script,
without any code recompilation, to suit the needs of the end-user.
The C, C++ part will remain intact.

I could not find good examples, that could help me with this, in the
references from python.org. I would appreciate your help.

thanks
Henko

Jul 18 '05 #2

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...
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...
4
by: adsheehan | last post by:
Hi, I am embedding Python into a multi-threaded C++ application running on Solaris and need urgent clarification on the embedding architecture and its correct usage (as I am experience weird...
8
by: Thomas Bartkus | last post by:
Name: lib64python2.4-devel Summary: The libraries and header files needed for Python development Description: The Python programming language's interpreter can be extended with dynamically...
2
by: John Dean | last post by:
Hi Could somebody, please tell me where I can find information about embedding Python into a C/C++ application. The example in the docs is rather simple. I am looking for something a bit more...
0
by: Kenneth McDonald | last post by:
Sorry for crossposting to several lists, but from what I can tell, what I want to do may involve several different areas of expertise. (None of which I have :-( ) I'd like to use Gecko as the UI...
4
by: David Abrahams | last post by:
I'm seeing highly surprising (and different!) behaviors of PyImport_ImportModule on Linux and Windows when used in a program with python embedding. On Linux, when attempting to import a module...
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.