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

EMBEDDING Youtube-DL in Python with Batch File

Ok, I know that to get Mp3 files from Youtube-DL in a python program you use from __future__ import unicode_literals import youtube_dl ydl_opts = { 'format': 'bestaudio/best', 'postprocessors': [{ 'key': 'FFmpegExtractAudio', …
0
votes
1 answer

Embedding Numerical Categories

I have a vanilla LSTM model which classifies the input data by outputting a probability distribution of 6 categories. Nothing too crazy. Now, the model works and gives me an output, of which I take the max to categorise my input. However, I think…
Landmaster
  • 1,043
  • 2
  • 13
  • 21
0
votes
1 answer

EXC_BAD_ACCESS or SIGABRT while calling scipy.stats.anderson_ksamp from C++

I'm having troubles figuring out what's wrong in my code. I'm trying to use the Python function anderson_ksamp from the scipy.stats module using Python's and numpy's C APIs in my program written in C++. The thing is that I get this error and I can't…
jackscorrow
  • 682
  • 1
  • 9
  • 27
0
votes
1 answer

Keeping PySerial port open during development other classes

I'm using a serial connection via Bluetooth to read results from an IMU. I'm done writing some low level methods setting up the basic connection. But when writing the other classes (e.g. visualize or calculate) I'm continuously closing and reopening…
0
votes
0 answers

Python 3.4 C API embedding Import errors for modules that should exist

I am using WinPython's python distribution as my interpreter. It should be able to import all the modules that I need in order to run some example code. I have verified this by running the module using the python.exe included with the…
terminix00
  • 327
  • 2
  • 13
0
votes
1 answer

PythonQt doesn't print anything

I'm following the examples at http://pythonqt.sourceforge.net/Examples.html, but PythonQt doesn't print anything on the console. I execute a script that just prints hello, but nothing gets printed. PythonQt::init(); PythonQtObjectPtr context =…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
0
votes
3 answers

How can convert PyObject variable to Mat in c++ opencv code

I have a c++ facerecognition code and a python code in opencv. In python code i read frames from a robot and i want to send this fram to my c++ code. I use this link tho call python function in c++ function. my c++ function is embed.cpp: #include…
narges
  • 681
  • 2
  • 7
  • 26
0
votes
1 answer

youtube-dl download videos with formatid

------------------------------Format Numbers---------------------------------------------------------------------- 249 webm audio only DASH audio 52k , opus @ 50k, 629.08KiB 250 webm audio only DASH audio 69k ,…
0
votes
1 answer

Embedded Python3 raise an exception when importing a local module

I'm trying to embed a Pyhton3 program into a C++ one. After following several tutorials and blog posts I get the following code, which fails: Py_SetProgramName(_program_name); Py_Initialize(); PyObject* main =…
Kleag
  • 642
  • 7
  • 14
0
votes
0 answers

Python embedding C++: Importing external modules

I am trying to run a python module using C++. I am using the instructions provided in https://docs.python.org/2/extending/embedding.html. My C++ code: #include #include #include #include #include…
pd176
  • 821
  • 3
  • 10
  • 20
0
votes
1 answer

Embedded python in c++ on raspberry pi

Before I asked for how to call c++ in python, but that's quite difficult to me. And later on I found that if calling python in c++ seems much more easily. As I followed the tutorial on codeproject, I've got the following problem while I compile…
KTang
  • 340
  • 1
  • 17
0
votes
2 answers

How to resolve bindings during execution with embedded Python?

I'm embedding Python into a C++ application. I plan to use PyEval_EvalCode to execute Python code, but instead of providing the locals and globals as dictionaries, I'm looking for a way to have my program resolve symbol references dynamically. …
Tony the Pony
  • 40,327
  • 71
  • 187
  • 281
0
votes
0 answers

Python type error while embedding

I am trying to run following python code from c++(embedding python). import sys import os import time import win32com.client from com.dtmilano.android.viewclient import ViewClient import re import pythoncom import thread os.popen('adb…
Kumar
  • 616
  • 1
  • 18
  • 39
0
votes
0 answers

python based shell embedded in c++ + select

I have an event based application where I select() on various things and depending on what gets selected, the application handles it. To add to this, I want to add an interactive menu implemented in python. In a typical update() (called from within…
brainydexter
  • 19,826
  • 28
  • 77
  • 115
0
votes
1 answer

Calling sympy using C++ embedding

I am trying to use sympy with my c++ program and am using the following embedding code to do that. int sym_ex(const char * input_expression, const char * output_expression){ PyObject *pName, *pModule, *pDict, *pFunc; PyObject *pArgs,…
Charith
  • 1
  • 1