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

Embedded Python in C++ can't execute pygame

The idea is to run a python script from within a C++ application. From the C++ side, the PyRun_SimpleString() method is called which executes a python script. In the python script the pygame library is imported first with the idea to open a new…
Manuel Rodriguez
  • 734
  • 4
  • 18
0
votes
0 answers

When using python-embedded version and doing pip install * it runs into a ModuleNotFoundError

I am reflecting some python packages into .Net using https://github.com/henon/Python.Included, which relies on the python-embedded installation. I enabled pip, which is not officially supported for python-embedded by following this method. Now let's…
0
votes
0 answers

How to send python list to a C array of string and to a C array of long integers?

I have tried to send a python list to a C array of string/integers. And I tried to print the array of string but it is printing nothing. I am actually writing code to extract data from a .csv file by using Python and trying to send this data to a C…
0
votes
1 answer

Have C Start Python Interpreter under a USC-2

I am trying to run Python embedded within a simple C program. However, when I import a module, I got an error undefined symbol: PyUnicodeUCS2_DecodeUTF8. Upon further investigation, I discovered that the Python interpreter started under…
xyanxy
  • 3
  • 2
0
votes
1 answer

How to fix PyImport_Import in C++ (Exception in python35.dll)

I am trying a really basic "hello world" program, which should embedd a python script in my C++ console application, but it fails at pModule = PyImport_Import(pName); with an unspecified exception "Access violation reading location ..." I was…
shup
  • 120
  • 1
  • 16
0
votes
1 answer

How to link the correct python version when embedding in C++?

I embedded a python interpreter in C++ code. It works fine for the high-level way with: PyRun_SimpleFileEx(fd, "/file_path/some_script.py", 1) But I need to pass some arguments to the python code so I tried to go forward with some code from the…
0
votes
1 answer

Embedded Python loads module but does not load that module's internal import statements

At long last(!) I've compiled Boost::Python and have gotten my XCode project to import a local module. This module starts with the line from xml.dom import minidom, but when it executes, I'm given this error: Traceback (most recent call last): …
TIMOOOO
  • 116
  • 5
0
votes
1 answer

TypeError: Can't convert 'text': data type not understood

I am trying to do an embedding process for a paragraph, the process is called 'Universal Sentence Encoding' from google. This needs to be done for a deep-learning classification process. which gives me the following error: DAN U-S-E model…
Arav
  • 143
  • 1
  • 1
  • 10
0
votes
0 answers

Embedding python in Visual C++

I am trying to embed python in a Visual C++ application using visual studio 2017. I correctly included the header files path and the lib path from my Python 3.7.0 installation. I can include the Python.h and pylifecycle.h files but get an error when…
Danial Esaid
  • 51
  • 1
  • 4
0
votes
1 answer

Embedding python in cpp: How to get a C-pointer to a python function (not to a PyObject)?

I want to enable the writing of user python-plugins for an existing C++ application. The main application will emit signals using boost::signals2 that trigger the execution of the users python code. I set up a working sample where an initialize…
uha
  • 3
  • 2
0
votes
2 answers

Encoding for embedding python in C++

I'm trying to embed a python code in C++ and it compiles successfully but when I try to run my code, I get the following error. File "./cppPython", line 1 SyntaxError: Non-ASCII character '\x88' in file ./cppPython on line 2, but no encoding…
Abhishek Arya
  • 450
  • 4
  • 16
0
votes
0 answers

Embedding Python in C++ : Cannot convert a string or char* to a numpy array

I am very new to the idea of embedding python with C++. I am running into the following problem : I follow the documentation and am able to convert my string data to a python object and then call the Python Function using code similar to : const…
Alok
  • 163
  • 1
  • 14
0
votes
1 answer

Error when Importing keras in embedded python in C

I'm trying to embed python in my C application. I download the package in python official website and manage to do a simple Hello World. Now I want to go deeper and use some libraries of python like numpy, keras, tensorflow... I'm working with…
Meph
  • 280
  • 3
  • 9
0
votes
1 answer

Embedding python in c++: Segmentation fault

I am remote Debugging a c++ application with Visual studio on a linux device (raspberry pi/raspbian). In this c++ application I embedded a simple Python script by loading the function using the Python/c api. This is my c++ Code: #include…
0
votes
1 answer

How to use final_embeddings?

From udacity notebook exercise; After embeddings were trained, I'm trying to get all related words from an input word and I'm getting wierd results. Is the code below correct? udacity exercise final_embeddings =…