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

Right now I have an image processing algorithm that is roughly 100 lines or so in Python. It takes about 500ms using numpy, PIL and scipy. I am looking to get it faster, and as the actual algorithm ...
Chrispresso's user avatar
  • 4,338
1 vote
0 answers
232 views

I have created a Python interface to my library using SWIG. This Python interface uses numpy. All of this works correctly. Now, I want to package this Python interface into a Python wheel. Packaging ...
Didier Trosset's user avatar
10 votes
1 answer
2k views

I would like to pass as argument of a function in my C module an array of uint8_t's. I couldn't find a method to directly parse this array, so I'm parsing it to a PyObject_t and then iterating as a ...
Pedro Alves's user avatar
  • 1,748
0 votes
1 answer
383 views

I am trying to write a python extension module where some of the functions are curried, but I am not quite sure how to go about doing so. The main difficulty being that I am not sure how to create and ...
Brandon Ogle's user avatar
0 votes
1 answer
379 views

I'v written a Python extension module with C to speed up computation times. The first step is a 2D integration of a function f(x,y,k), which is very fast and allows me to integrate over y in [y1(x),y2(...
sunra's user avatar
  • 21
1 vote
0 answers
705 views

The command pip install matplotlib in a virtualenv fails with: g++ -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro build/temp.linux-x86_64-3.5/src/ft2font.o build/temp.linux-x86_64-3.5/...
rubik's user avatar
  • 9,184
1 vote
1 answer
3k views

I have managed to run a simple script located in a 'scripts' folder using 'runscript' from django-extensions. The technique is described here [1] (https://django-extensions.readthedocs.org/en/latest/...
Peter Groves's user avatar
3 votes
4 answers
3k views

I'm working on porting a Python module to Windows. I have a toy example as follows. The folder structure is: foo/ libfoo/ foo.c setup.py setup.py from setuptools import setup, Extension ...
nbui's user avatar
  • 192
2 votes
0 answers
225 views

I have a function which returns an llvm::Value*, which I would like to expose to Python. I do not need to expose an interface to llvm::Value; it can be an opaque object in Python. When I call the ...
trbabb's user avatar
  • 2,135
2 votes
1 answer
430 views

I have a project directory structure: myproject/ setup.py myproject/ editors/ .... utilities/ ... find_inf.f90 All the files in the project are python, except for ...
deepak's user avatar
  • 2,085
4 votes
2 answers
4k views

I was trying to pass a value by calling C file from python and then return that value from C to python again. My question is how to do this? Can it possible to use return Py_BuildValue(a+b) kind of ...
kshitijsoni1's user avatar
3 votes
2 answers
2k views

I am creating Python interfaces to some C++ code that I cannot change, using SWIG. One of the C++ classes has a constructor that creates a partially initialized object that cannot be used as yet, an ...
doetoe's user avatar
  • 831
5 votes
1 answer
5k views

Hi I am trying the swig python extension, in c++, example - on an Mit page My header is - shapes.h #include <iostream> class Shape { public: Shape() { nshapes++; } ...
Ankit Mishra's user avatar
1 vote
0 answers
663 views

After moving to python 2.7, I am getting the following warning: /opt/python/python-2.7/lib64/python2.7/pkgutil.py:246: RuntimeWarning: compiletime version 2.6 of module 'extension' does not match ...
Satyen Rai's user avatar
  • 1,543
1 vote
0 answers
149 views

I'm having some problems understanding the importing of a python package with extensions that was installed with setup.py. The packages is 'gmes', and it has 4 extension modules which are .so files. ...
user5517325's user avatar
1 vote
0 answers
45 views

I am working on a Python extension module in C++ and I have a FILE object and I want to propagate it Python code so I can work in some way (reading, writing, etc). In Python2 it was possible to use ...
dohnto's user avatar
  • 614
0 votes
0 answers
348 views

I am getting an undesired loading of a shared library which has already been loaded. I have a binary(test_bin) which is supposed to load a shared library(libtest.so). Also, I have a C python ...
Kanishka Khandelwal's user avatar
6 votes
2 answers
3k views

I am writing C extensions for python. I am just experimenting for the time being and I have written a hello world extension that looks like this : #include <Python2.7/Python.h> static ...
ironstein's user avatar
  • 567
0 votes
3 answers
871 views

So I'm feeling that Google is getting tired of trying to help me with this. I've been trying to experiment some with the SndObj library as of late, and more specifically the python wrapper of it. ...
JohanPI's user avatar
  • 161
13 votes
2 answers
6k views

I was writing code to store a (potentially) very large integer value into an array of chars referenced by a pointer. My code looks like this: cdef class Variable: cdef unsigned int Length ...
Woody1193's user avatar
  • 8,202
1 vote
1 answer
384 views

if I call a SWIG-wrapped C/C++ function from Python, is it possible to obtain the current call stack? I would like something similar to the result of ''.join(traceback.format_stack()), but I don't ...
shaoyl85's user avatar
  • 1,999
0 votes
0 answers
161 views

Say I have a python class object: class A: pass o = A() o.a=8 # or any data type such as numpy arrays and I want to pass that python object to C++ extension: import cpp_lib cpp_lib.run(o) ...
Hailiang Zhang's user avatar
12 votes
2 answers
8k views

I am writing a python/C++ application, that will call methods in C++ extension from python. Say my C++ has a class: class A { private: int _i; public: A(int i){_i=i;} ...
Hailiang Zhang's user avatar
1 vote
2 answers
608 views

Given a class object in Python, how can I determine if the class was defined in an extension module (e.g. c, c++, cython), as opposed to being defined in standard python? inspect.isbuiltin returns ...
Robert T. McGibbon's user avatar
0 votes
1 answer
287 views

Is there a way to find out the type of a Python Object in C extension? I need to pass a name(string) or a double value from script to my extension. I thought I could call parsetuple in my extension ...
HJR1's user avatar
  • 1
2 votes
1 answer
115 views

I am attempting to build a (very simple) Python extension from C code and have run into a snag in the compilation. (For the record: my C skills are very out-of-date and my code is probably awful.) ...
TrevorNT's user avatar
-1 votes
2 answers
70 views

Extensions are just dynamic link library, which should not have problem across different version of MSVC.
xuhdev's user avatar
  • 9,614
3 votes
1 answer
3k views

I'm trying to build python extension. I've create simple library that export single function. It's just a single file - testlib.c that implements function called 'apicall'. Then I create SWIG ...
Evgeny Lazin's user avatar
  • 9,463
4 votes
2 answers
741 views

I need to create python wrapper for the library using SWIG and write unit tests for it. I don't know how to do this. My first take on this problem is to mock dynamic library with the same interface as ...
Evgeny Lazin's user avatar
  • 9,463
60 votes
4 answers
20k views

We've been long-time fans of pylint. Its static analysis has become a critical part of all our python projects and has saved tons of time chasing obscure bugs. But after upgrading from 1.3 -> 1.4, ...
user590028's user avatar
  • 11.8k
29 votes
2 answers
23k views

I am attempting to write a C extension for python. With the code (below) I get the compiler warning: implicit declaration of function ‘Py_InitModule’ And it fails at run time with this error: ...
Sam Redway's user avatar
  • 8,287
13 votes
2 answers
6k views

I wrapped some C code for Python and it works. The C module creates a handle, which I pass to Python as PyCapsule. The API I would like to have can be made in Python like: import wrapped class Test(...
Lars Hanke's user avatar
38 votes
2 answers
31k views

Short version I recently came across some Python code in which the return type for a function was specified as PyObject in the documentation. What is a PyObject? Detailed version I am not a C/C++ ...
eric's user avatar
  • 8,285
3 votes
1 answer
233 views

I'm trying to write a C++ extension for Python (3.x) that allows me to use a specific hardware shield for the Raspberry Pi. I haven't got any experience in writing C and/or C++, but using the ...
bennierex's user avatar
0 votes
1 answer
634 views

I'm writing a Python Module using the C extension API and am trying to pass a long variable from Python into the C function and then from that get the raw PyLongObject used to represent this variable. ...
ali2992's user avatar
  • 121
0 votes
1 answer
49 views

I have successfully built boost.python with visual c++ 2010(dynamic library, 64-bit). I have python 2.7.8 64-bit installed on windows 7 64-bit. I've read here that python extensions should be built ...
Mohammed Safwat's user avatar
1 vote
1 answer
745 views

I downloaded a python-wrapped C++ code and am trying to build it from source, and it compiles without errors, but when I run the end result, it fails in a way that seems to suggest that it did not ...
Steve Byrnes's user avatar
  • 2,260
0 votes
1 answer
980 views

I am new to python and C-extensions. I am writing a python code where I have created two threads and have defined a callback function py_cb(). In one thread I am appending to a global list after ...
amanand's user avatar
  • 25
6 votes
1 answer
3k views

I'm just trying to start off by creating a numpy array before I even start to write my extension. Here is a super simple program: #include <stdio.h> #include <iostream> #include "Python.h"...
Alex Z's user avatar
  • 1,549
1 vote
1 answer
605 views

To build I use distutils: python setup.py build_ext --inplace Building a simple pyx-file works (setup.py): from distutils.core import setup from Cython.Build import cythonize setup( ext_modules ...
Asken's user avatar
  • 8,147
3 votes
1 answer
656 views

According to the Python documentation, when compiling a Python extension on Windows, "you should use the same version of VC++ that was used to build Python itself". The explanation usually given is ...
Ray's user avatar
  • 4,731
0 votes
1 answer
463 views

Request: could someone post a recipe, from top to bottom, for creating an Xcode project that will compile C code to build a Python extension? I've seen several posts here that touch upon the subject,...
Joymaker's user avatar
  • 1,624
4 votes
1 answer
3k views

I have a custom python module for fuzzy string search, implementing Levenshtein distance calculation, it contains a python type, called levtree which has two members a pointer to a wlevtree C type (...
woggioni's user avatar
  • 1,442
9 votes
3 answers
10k views

I'm writing a C extension for a python application, and need to test python-specific C code. To do so I need to import Python.h into my C files, but for the life of me I haven't been able to do that. ...
Faiyam Rahman's user avatar
1 vote
1 answer
493 views

I am writing a python program that includes an extension module written in C. The extension module defines a function that is used in my program continually. I have a memory leak somewhere in my ...
Faiyam Rahman's user avatar
1 vote
0 answers
158 views

I am having a lot of trouble trying to build Python extensions on a particular machine. It has both VS2008 and VS2013 installed along with, what I believe to be, the correct C/C++ libraries, etc. I am ...
SimplyKnownAsG's user avatar
1 vote
0 answers
935 views

i am getting a segmentation violation in the python interpreter when trying to access a variable which is returned by my own OpenMP C++ extension. All the solutions which i have found are either ...
Philipp's user avatar
  • 535
0 votes
1 answer
775 views

i want to write a c++ class with PyObjects to access them from Python to reference them with an existing Python object instance. In short words i want to store/manage Python object instances in the C++...
Flo's user avatar
  • 155
48 votes
6 answers
91k views

I have been trying to install Cython for Python 2.7 on my Window 7 system. In particular, I prefer everything in 64 bits. (In case you wonder, I need Cython because Cython is one of the components I ...
Argyll's user avatar
  • 10.1k
2 votes
2 answers
3k views

I'm trying to write Cython code to dump a dense feature matrix, target vector pair to libsvm format faster than sklearn's built in code. I get a compilation error complaining about a type issue with ...
AatG's user avatar
  • 755

1
3 4
5
6 7