python-embedding Questions

6

I am trying to follow the simple example for embedding python within c++ using pybind11 as found on this page. However, when trying to use cmake to build the solution, I keep getting an error that ...
Flyblow asked 4/8, 2020 at 20:26

3

Solved

I'm trying to run the Embedding Python in .NET example from https://github.com/pythonnet/pythonnet. I've followed troubleshooting articles to set the proper %PYTHONPATH% and %PYTHONHOME% to my anac...
Creed asked 29/11, 2017 at 18:45

5

Solved

I'm embedding the python interpreter in a multithreaded C application and I'm a little confused as to what APIs I should use to ensure thread safety. From what I gathered, when embedding python it...
Materiality asked 16/5, 2012 at 19:43

5

Solved

I'm trying to run the embedding example and I can't load a module from the current working directory unless I explicitly add it to sys.path then it works: PyRun_SimpleString("import sys"); PyRun_S...
Radioelement asked 16/11, 2012 at 19:0

2

Solved

I'm using Cython in --embed mode to produce a .exe. I'm evaluating the Minimal set of files required to distribute an embed-Cython-compiled code and make it work on any machine. To do this, I only ...

10

Solved

I'd like to call a custom function that is defined in a Python module from C. I have some preliminary code to do that, but it just prints the output to stdout. mytest.py import math def myabs(x): ...
Cimon asked 20/7, 2010 at 1:54

2

Solved

Consider the following MWE: #include <Python.h> #include <stdio.h> int main(void) { printf("Test 1\n"); Py_Initialize(); printf("Test 2\n"); PyRun_SimpleString("print('Test 3')");...
Bra asked 30/6, 2015 at 9:13

2

Solved

I'm running a C++ application which tries to run python using the https://docs.python.org/3.5/extending/embedding.html function calls. This is the error that the application error message pipes are...
Catron asked 11/4, 2018 at 21:14

1

ydl = youtube_dl.YoutubeDL() with ydl: r = ydl.extract_info("myplaylist", download=False) # don't download, much faster print(r['uploader'],r['title'],r['thumbnail']) code output like this [yo...
Zoology asked 1/8, 2016 at 21:20

3

For a project I am working on a simple harmonic motion simulator (How a mass oscillates over time). I have got the data produced correctly and already have a graph produced within a tkinter frame w...
Involutional asked 17/1, 2014 at 23:13

1

Solved

I'm trying to understand sub-interpreters and GIL. But my experiment is failing often(The same code rarely works). Gathering info from SO questions and few sites, I have the following code which s...
Refutation asked 9/1, 2020 at 14:39

0

The deprecation of Python's PyEval_ReleaseLock has introduced a problem in our codebase: We want to terminate a Python interpreter from a C callback function using Py_EndInterpreter So to do that,...
Carrolcarroll asked 18/9, 2019 at 14:8

3

Solved

If I embed the Python interpreter in a C or C++ program, as in this example, is there any way to limit how long the interpreter runs for? Is there anything to stop the Python code from entering an ...
Disintegrate asked 24/7, 2016 at 16:16

1

I have a C++/Qt application in which I want to embed the Python interpreter. I want to call Python from a QThread, but I'm getting a deadlock at the line where I call PyGILState_Ensure() in order t...
Judejudea asked 28/12, 2017 at 9:40

1

Solved

My question is regarding embedding Python 3.5 interpreter in a C++ program to receive an image from C++, and use it as an input for my trained tensorflow model. When I import tensorflow library in ...
Asteria asked 13/9, 2017 at 6:25

1

Solved

I am trying to use Python 3.5 interpreter embedded in a C++ program to receive an image from C++, and use it as an input for my trained tensorflow model. First, I convert my image to numpy array an...
Mcinnis asked 12/9, 2017 at 6:44

1

Solved

SPOILER: partially solved (see at the end). Here is an example of code using Python embedded: #include <Python.h> int main(int argc, char** argv) { Py_SetPythonHome(argv[1]); Py_Initializ...
Gynandrous asked 11/8, 2017 at 15:4

2

Solved

I would like to embed Python interpreter in to a Qt 5 application. I have a working application in Qt 5 but when I put #include <Python.h> at the top (below Qt headers) the compilation br...
Josephinajosephine asked 25/2, 2013 at 22:49

0

I am embedding Python in a C++ application and I also need to call back in to the C++ code from Python. I have been able to do this with the following simple example but I'm having a weird problem ...
Pietro asked 26/1, 2017 at 14:21

3

Solved

Here's a CPython program that tries to initialize the interpreter with an empty sys.path: #include <Python.h> int main(int argc, char** argv) { wchar_t* program = NULL; wchar_t* sys_path ...
Verniavernice asked 16/11, 2016 at 14:2

2

Solved

My project structure looks like this: emb | CMakeLists.txt | main.c | python35.lib | stdlib.zip | _tkinter.pyd | +---include | | | | abstract.h | | accu.h | | asdl.h ... | | warnings.h | | weakref...
Laminar asked 9/11, 2016 at 0:6

1

Solved

Okay here's the basic example from the Python website for a simple runpy.exe to run Python scripts below. It works fine using Visual Studio 2015 on x64 Windows after referencing the Python includes...
Rouleau asked 12/7, 2016 at 15:36

4

Solved

This semester, I'm implementing a compressed-sensing algorithm as an iPhone app. To do this, I'll need some good matrix/linear algebra libraries. I'm a little new to both iOS and Python, and ...
Julijulia asked 14/1, 2012 at 6:15

1

Solved

I embedded python in my C++ program. I use PyImport_ImportModule to load my module written in a .py file. But how can I load it from memory? Let's say my .py file is encrypted, so I need to first ...
Suffragan asked 3/6, 2016 at 3:51

1

Solved

I am trying to embed a python program inside a C program. My OS is Ubuntu 14.04 I try to embed python 2.7 and python 3.4 interpreter in the same C code base (as separate applications). The compila...
Ortolan asked 10/4, 2016 at 13:52

© 2022 - 2024 — McMap. All rights reserved.