Skip to main content
Filter by
Sorted by
Tagged with
7 votes
1 answer
2k views

I have a function foo in a Python Extension Module that should return a tuple of ints to Python. This can be easily done using Py_BuildValue: static PyObject* foo(PyObject* self, PyObject* args) { ...
MaxPowers's user avatar
  • 5,529
0 votes
0 answers
980 views

I am trying to pass a numpy array to a customized C++ extension but somehow I got a segmentation fault. Here I made a simplified version of my code. On the C++ side, I simply parse a bytes object ...
Zhenglin Geng's user avatar
3 votes
0 answers
382 views

The Cython project I am currently working on includes some 20 C++ files that act as C++ implementation. On top I have built three Extension Modules written in Cython, each of them capturing different ...
ibarrond's user avatar
  • 7,871
6 votes
0 answers
1k views

I am trying to build a C based Python extension that uses a ffmpeg libraries. Since there are a bunch of libraries I have to import. I used CMake. I followed the instructions from python doc The ...
Gatothgaj's user avatar
  • 1,731
2 votes
1 answer
2k views

I wrote a library (dll) in c++ that uses an embedded Python interpreter. Executing Python scripts in the embedded interpreter works fine when the library is used by a c++ program. If I call the ...
siehe-falz's user avatar
0 votes
1 answer
333 views

I am in the process of developing a Python extension to allow a script running on a Raspberry Pi to control a sensor. The sensor manufacturer provided my organization with the source code to their C ...
SquawkBirdies's user avatar
6 votes
1 answer
7k views

I build a compiled Python extension (.pyd file) with C++ and pybind11. I would like to generate a single Python interface .pyi file for my .pyd file. There are a few similar questions referring to ...
Alex Tereshenkov's user avatar
0 votes
1 answer
162 views

i am writing a Test to keep Data in a C++ map. I am using the Python C-Api. Adding int values and getting the length of the map is no problem. But when i get a value from the map and want to return it ...
schmetz Yannick's user avatar
1 vote
0 answers
325 views

I managed to build *.pyd library. Sweat, blood, tears and gore aside, it turned out to be about 4 (four) times smaller than the corresponding *.so library. While the code seems to work, I cannot ...
wvxvw's user avatar
  • 9,713
0 votes
1 answer
756 views

I'm trying to build a Python extension which links to APR. And this time it's on MS Windows... (It works on Linux). Here's where the build fails, the command, and the output formatted for ...
wvxvw's user avatar
  • 9,713
-1 votes
1 answer
306 views

PyObject_Call segfaults when it is called with an instance of a bound method, but works fine when invoked with regular (unbound) procedures or with an instance of a class that implements __call__, or ...
wvxvw's user avatar
  • 9,713
2 votes
0 answers
190 views

So, I'm interested in communicating between a C program and a Python program so that I can neatly send tasks and data between the two. I figured I'd go ahead and start with this guide. In this guide ...
David Montgomery's user avatar
5 votes
1 answer
10k views

I am building a Python extension (.pyd) using Visual Studio 2015 C++ project and Python 2.7 32bit. This is my .cpp file: #include <Python.h> static PyObject* GetTwoInts(PyObject* self, ...
Alex Tereshenkov's user avatar
4 votes
0 answers
791 views

I am trying to cross compile a software on a Linux machine targeting a Windows system using Mingw. Baiscally in the software compilation a Python extension is built and here we have the problems: ...
rakwaht's user avatar
  • 4,017
4 votes
0 answers
3k views

I have a python module which contains a C++ extension as well a shared library on which the C++ extension depends. The shared library is picked up by setuptools as an extra_object on the extension. ...
mcguip's user avatar
  • 6,337
1 vote
0 answers
292 views

I have a toy project that's implemented as a C++ library and exposed to Python using a Cython wrapper. After not touching the project for a few months, I tried to build it from scratch today and got ...
Daniel Standage's user avatar
1 vote
1 answer
859 views

I'm working on a C++ extension for Python 3 and trying to pass a DateTime object to my function. the PyDateTime_Check function seems to work and returns true, but when I try to get the year from the ...
Lucian's user avatar
  • 174
0 votes
1 answer
355 views

I want to write a python object in c that holds a numpy vector (two actually, but just one in this minimal example). To begin with, I just want to create an object with a numpy array and see that I ...
The Unfun Cat's user avatar
1 vote
1 answer
4k views

Tried all the possible options like import pandas as pd df = pd.read_csv('AD_Data') data = pd.ExcelFile("AD_Data") xl_file = pd.ExcelFile(AD_Data) dfs = {sheet_name: xl_file.parse(AD_Data) for ...
Masum Billah's user avatar
1 vote
1 answer
121 views

Currently, I am trying to write a C Python extension. Specifically, I am trying to create a python module that has a couple of classes in it. Basically, I want it to look something like this: ...
Charlie Sale's user avatar
1 vote
1 answer
233 views

I have some python code which is heavily dependent on greenlets. I can use either gevent or eventlet. I have packaged some sections of the code in a C-extension but these calls do not yield to other ...
JMzance's user avatar
  • 1,763
1 vote
1 answer
230 views

I'm trying to build a Python extension with C++ 14. When the module is initialized in Python, I ask caller giving me a callback function which take a string as input. When a function in the module is ...
NonStatic's user avatar
  • 1,111
0 votes
1 answer
336 views

I'm trying to extend libhydrogen (open source found here: https://github.com/jedisct1/libhydrogen/) to support calls to the underlying library in Python. However, I ran into a strange issue. ...
Hanson Duan's user avatar
1 vote
1 answer
2k views

I am writing a python extension in C. There is a library for a raspberry hw dev board in C so I'm using that. So I'm exporting a function from C to python and at the end of the call, python falls over ...
sDoky's user avatar
  • 368
2 votes
2 answers
1k views

I created a pandas dataframe with pd.DataFrame({"A": ["dog", "cat"]}) and sent to a c extension the resulting numpy array. In C, I do: PyArrayObject * pArray = (PyArrayObject *) pArrayObj; ...
PBelzile's user avatar
  • 118
2 votes
1 answer
500 views

I can't figure out how to change the value of a parameter passed from Python to C. PyArg_ParseTuple (args, "Os", &file_handle, &filename) will let me get file_handle as a PyObject *. Is ...
Jay Lofstead's user avatar
0 votes
1 answer
87 views

I try to create a Python extension which will host a HTTP server. When a particular request coming in, the extension calling a Python code from the extension consumer to handle the request. Since HTTP ...
NonStatic's user avatar
  • 1,111
1 vote
1 answer
647 views

I wrote a library in Cython that has two different "modes": If rendering, I compile using GLFW. If not rendering, I compile using EGL, which is faster, but I have not figured out how to render with it....
ethanabrooks's user avatar
3 votes
0 answers
151 views

Okay there, i have some code in python that opens a file -> process it -> and writes data to other file. def ELECrypt(myFile, outFile, code): Code = list(bytes(code,'utf-8')) with open(myFile,...
Richard Tyshchenko's user avatar
5 votes
2 answers
3k views

I wrote a C Extension to access an error message for a camera from a proprietary library. The structure is setup.py dicamsdk\ |---__init__.py |---control.py |---pcoError.c with setup.py from ...
smiddy84's user avatar
  • 305
26 votes
3 answers
12k views

I've written a Python module that depends on some C extensions. Those C extensions depend in turn on several compiled C libraries. I'd like to be able to distribute this module bundled with all the ...
Sevenless's user avatar
  • 2,855
2 votes
1 answer
800 views

I have been working on a Python C/C++ extension, I managed to get everything working so far except a method that adds two structures called "int_obj" that have an integer inside and returns a new ...
Andrés Rangel's user avatar
0 votes
1 answer
510 views

I have this C SDK that I'm working on creating a Python extension for. The C SDK documentation says that it expects a ffmpeg executable in it's working directory. My current project structure is: my-...
jim's user avatar
  • 140
-1 votes
1 answer
805 views

I have a C++ project which uses a couple of c++14 features including std::make_unique. The project compiles and runs fine and has done for a while however, now I am trying to add a python interface ...
JMzance's user avatar
  • 1,763
0 votes
1 answer
381 views

I work on 64 bit windows with 64 bit python 2.7 and i am trying to compile my first c++ extension for python. At first i tried to use mingw but ran into many linker errors, so now i use c++ for python ...
Cebarik's user avatar
0 votes
1 answer
508 views

What is the fastest way to call C/C++ functions and use C++ classes? There are various methods to do this such as Python Extension Module (Python.h), Cython, SWIG, Boost, and etc. I've already ...
Dayamre's user avatar
  • 2,187
3 votes
0 answers
428 views

I am trying to get a python c extension to work. The extension is used in a package which registers a python callback with the extension and then the extension calls it to communicate with the python ...
viterbi's user avatar
  • 429
2 votes
2 answers
661 views

So I needed to use the code of the subprocess module to add some functionality I needed. When I was trying to compile the _subprocess.c file, it gives this error message: Error 1 error C2086: '...
Omer's user avatar
  • 456
1 vote
1 answer
619 views

PyDev with Python3.5 seems unable to recognize imports from c-compiled extensions, including packages compiled via Cython. I am working on an up-to-date debian/stretch machine with a stripped-down ...
ZioByte's user avatar
  • 3,106
0 votes
3 answers
385 views

I would like my program to exit regardless of the type of the exception that occurred. However, depending on the type of the exception, I want to log a different error message. How could I achieve ...
c00der's user avatar
  • 543
0 votes
0 answers
40 views

For example, if I run the following command: bjam --toolset=msvc-14.0 address-model=64 --with-python python-debugging=off threading=multi variant=debug toolset=msvc-14.0 link=static --stagedir=stage\...
DNg's user avatar
  • 452
0 votes
0 answers
61 views

I've followed this video tutorial on setting up a very basic C++ extension for python using Visual Studio. It's very straightforward and works quite nicely. https://www.youtube.com/watch?v=y_eh00oE5rI ...
DNg's user avatar
  • 452
1 vote
1 answer
421 views

I need to read local variables from Python in C/C++. When I try to PyEval_GetLocals, I get a NULL. This happens although Python is initialized. The following is a minimal example. #include <...
The Quantum Physicist's user avatar
11 votes
3 answers
2k views

I want to create a function in C that extends Python that can take inputs of either float or int type. So basically, I want f(5) and f(5.5) to be acceptable inputs. I don't think I can use if (!...
ansg191's user avatar
  • 439
5 votes
1 answer
1k views

I'm writing a Cython wrapper to a C++ library that I would like to distribute as a Python package. I've come up with a dummy version of my package that looks like this (full source here). $ tree . ├──...
Daniel Standage's user avatar
1 vote
0 answers
81 views

The python extension lsblib.so is created by cython and distutils, the build command generated from distutil is as following: /gpfs/software/openlava_sqa/3.3.3/etc/../include/lsbatch.h:1681: warning: ...
jaslip's user avatar
  • 423
2 votes
0 answers
2k views

I am attempting to use the xlsxwriter package to write and image to an eXcel file, but I keep getting the 'No module name 'xlsxwriter' error on the import statement. I am on a closed network, so I am ...
DonB's user avatar
  • 21
0 votes
1 answer
364 views

I need to load data from a csv file or an excel sheet (with rows and columns) into a two-dimensional python dict. For example, if the data in an excel sheet looks like this: name age gender ...
He Li's user avatar
  • 31
5 votes
1 answer
14k views

Using SWIG to build python extensions (xxx.so) is easier than distutils. You don't need to write a wrap.c program to wrap your original c program. So I'd like using SWIG than Distutils. But There is ...
horbat's user avatar
  • 93
1 vote
0 answers
134 views

# distutils: language = c++ # distutils: sources = cppcode.cpp from libcpp.string cimport string cdef extern from "cppcode.h" namespace "mynamespace": cppclass LinkedList[T]: LinkedList () ...
user3404608's user avatar

1 2 3
4
5
7