Questions tagged [python-embedding]

Questions regarding embedding Python interpreter in other applications, such that it may serve as a scripting language.

When embedding Python, the interface code does:

  • Convert data values from C to Python,

  • Perform a function call to a Python interface routine using the converted values, and

  • Convert the data values from the call from Python to C.

Reference

309 questions
0
votes
1 answer

Looking for a smarter way to convert a Python list to a GList?

I'm really new to C -> Python interaction and am currently writing a small app in C which will read a file (using Python to parse it) and then using the parsed information to execute small Python snippets. At the moment I'm feeling very much like…
Hobblin
  • 905
  • 1
  • 12
  • 22
0
votes
1 answer

Python C api iterate through classes in module

In this case, the module is a python script loaded from a file. I can't find anything on the Internet about this. If I could loop through all objects in the module, I can filter for classes using PyClass_Check. But I don't know how to do this…
rubenwardy
  • 679
  • 5
  • 21
0
votes
2 answers

precision loss while converting from python float to C++ double

I am embedding python code in my c++ program. The use of PyFloat_AsDouble is causing loss of precision. It keeps only up to 6 precision digits. My program is very sensitive to precision. Is there a known fix for this? Here is the relevant C++…
Akhil
  • 2,269
  • 6
  • 32
  • 39
0
votes
2 answers

Reset Python4Delphi engine?

I use D7 with Python4Delphi. After users have imported much of py-files, Python have all these modules cached. I need a way to reset Py engine. So that Py "forgets" all user-imported modules, and I have "clean" Python, w/out restarting the app. How…
Prog1020
  • 4,530
  • 8
  • 31
  • 65
0
votes
1 answer

Which API should I use to create multiple Python3 interpreter instances?

I am embedding Python3 interpreter into Cocoa app. My app needs multiple separated Python execution contexts, so I need to spawn multiple interpreters. Python3 manual offers at least two ways to spawn execution…
eonil
  • 83,476
  • 81
  • 317
  • 516
0
votes
1 answer

Microsoft Visual Studios 2012 Can't open "python33.lib"

I'm using the Boost libraries in MicroSoft Visual Studios 2012 for a C++ program that is going to have Python embedded into it. The problem is when I try to Build Solution [F7]; I get this :: Error 1 error LNK1104: cannot open file 'python33.lib'…
0
votes
1 answer

Embedding Python 3.3 in a C++ program while only able to read one line at a time from input

I am currently working on adding embedded Python support (and yes, extending is not an option) to a large program as part of my summer internship. Ideally, I can keep the Python support within a single .DLL, which currently contains the program's…
0
votes
2 answers

boost python, using a namespace other than main global

I am embedding python in my C++ application using boost python. I am a C++ programmer, with very limited knowledge of Python. I have a C++ class, PyExpression. Each instance of this class has a string expStr, which is a short user-entered (at…
user773494
  • 37
  • 2
  • 6
0
votes
1 answer

VC++ 6 "unresolved externals" on Python embedding project

I'm getting this bizarre linker errors on Visual C++ 6 (I didn't choose the tool). I don't even know where to start looking on this one (I have limited C++ experience). These are the errors: CScripting.obj : error LNK2001: unresolved external symbol…
A.R.
  • 1,888
  • 2
  • 14
  • 22
0
votes
1 answer

Typecasting to a struct after python embedding

I have a small python script embedded in a C++ program. After exposing the python object to C++ program and copying the value to a C++ variable, i try to typecast it to a struct, but i do not get the expected value. What is wrong here?] I am using…
Vigo
  • 707
  • 4
  • 11
  • 29
0
votes
1 answer

embedded python in c++, do i need python installed

when embedding python in a c++ application using #include "python2.6/Python.h" and linking -lpython2.6 does the target computer (computer running the final compiled program) need to have python installed in order to work with my…
yonigo
  • 987
  • 1
  • 15
  • 30
0
votes
0 answers

Embedding Python in Visual C++ and runtime error R6034

So over the past week or so I have been experimenting with embedding a python script into C. I have done this in successive stages. For one of my first attempts I would call my python script from C and within my python script a 2D colormap would…
user1750948
  • 719
  • 2
  • 10
  • 27
0
votes
1 answer

C++ and boost::python

Can I embed python into my app using only boost:python? Will I need any additional libraries to bring with my app? Or is there any embeddable language which natively supports unicode chars and does not need any libraries to bring with app
Ivan
  • 609
  • 8
  • 21
0
votes
0 answers

OpenCV - Getting incorrect SURF descriptors when running python code embedded into C++

I'm working on an image matcher that utilises depth information from the Kinect. I have already written quite a lot of code that does standard image matching in Python using OpenCV, however to make use of the Kinect I am using OpenFrameworks(C++).…
Kkov
  • 1,472
  • 2
  • 11
  • 20
-1
votes
0 answers

can't create tf.keras.Sequential()

I have Python embedded code in C++ (C Python API with Python3.9.6 and tensorflow==2.13.0, keras==2.13.1). Python code: model = tf.keras.Sequential() Output: File…
1 2 3
20
21