Tagged Questions
1
vote
0answers
43 views
Easiest and Fastest way to Embed a Python Script into C?
I have been looking at the Python/C API for embedding my python script into C. I want to know if there is an easy (or simpler) way to embed my python script without having to get too involved in the ...
0
votes
1answer
224 views
Running Python from Visual C++ code (Embedded Python)
I have this Visual C++ code, plus Python embedded in it, when I try to run external Python code using the below code, I get the error in the Debug mode:
Unhandled exception at 0x77cf15de in ...
2
votes
2answers
75 views
(Python C API) PyRun_StringFlags missing builtin functions?
I am trying to embed some python in my pet project. I have reduced my problem to the following code:
#include <Python.h>
#include "iostream"
int main(int argc, char *argv[])
{
...
0
votes
1answer
142 views
“overloading” doesn't work with stderr
/*---------------stdcallbk_module.h---------------------*/
#ifndef STDCALLBK_MODULE_H
#include <Python.h>
#define STDCALLBK_MODULE_H
// Type definition for the callback function.
typedef void ...
2
votes
2answers
200 views
Python / C-Api: Add class to module
Im currently trying to embed the python interpreter into my application. Because my application uses the Poco API for logging, I want to make it accessable through the logging module in python too.
...
3
votes
1answer
176 views
Why is this 'from-import' failing with PyRun_SimpleString?
I am working on a simple(?) embedded Python project. I have a custom package that has been installed into site-packages with 'setup.py install', e.g.:
in C:\Python27\Lib\site-packages\:
mypackage\
...
2
votes
1answer
265 views
Embedded Python 2.7.2 Importing a module from a user-defined directory
I'm embedding Python into a C/C++ application that will have a defined API.
The application needs to instantiate classes defined in a script, which are structured roughly like this:
class ...
3
votes
1answer
310 views
Printing a variable in an embedded Python interpreter
I have written a small C program that embeds Python. I'm setting it up correctly using Py_Initialize() and Py_Finalize(), and am able to run scripts either using PyRun_SimpleString or ...
0
votes
1answer
229 views
embedding python error on initialization
when im running C code to call python functions, there's error on Py_Initialize() The error is ImportError: No module named site. Ive tried to put Py_SetProgramName(argv[0]) but it doesnt work. The ...
0
votes
1answer
504 views
embedding python
Im trying to call python functions from C code, and i followed a sample from here
I also have the correct include file directries, library directries, and linked the python32.lib (im using python 32) ...
2
votes
1answer
514 views
Do PyImport_ImportModule and import statement load into different namespace?
Here is canonical example of a program extending embedded Python 3.x in C/C++:
#include <Python.h>
//// Definition of 'emb' Python module ////////////////////
static PyObject* emb_foo(PyObject ...
1
vote
1answer
301 views
Python C API don't load module
I'm trying to load a python module that contains a math and numpy import in C, using the C API. I can load and run the module but, if I import the math module it doesn't work.
I'm using Arch Linux, ...
2
votes
1answer
438 views
Embedding python + numpy code into C++ dll callback
I am new of python embedding.
I am trying to embed python + numpy code inside a C++ callback function (inside a dll)
the problem i am facing is the following. if i have:
Py_Initialize();
// some ...
2
votes
2answers
828 views
Embedding Python into C - importing modules
I am having problems using the Embedded Python for C as per the Documentation - Whenever I try using imported modules I get an :
Unhandled exception at 0x1e089e85 in PythonIncl.exe: 0xC0000005:
...
1
vote
1answer
464 views
How do I find out why importing failed with PyImportModule?
I have this code in a C application that's embedding Python (2.7.1):
{
PyObject *user_dict;
PyObject *user_func;
PyObject *result;
PyObject *header_tuple;
PyObject *original_recipients;
PyObject ...