Questions tagged [python-extensions]

Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.

323 questions
0
votes
1 answer

boost.python built with VC2010

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 with the same compiler that was used to build…
0
votes
1 answer

Accessing global variables from a python callback of C extension API

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 certain time intervals, whereas from the other thread,…
0
votes
1 answer

How to build python extension with Xcode

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, but they seem confusing and incomplete, and…
Joymaker
  • 813
  • 1
  • 9
  • 23
0
votes
1 answer

How can i declare a Boost.Python C++ Class with PyObjects

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++ class. For example: struct Var { PyObject…
Flo
  • 155
  • 1
  • 11
0
votes
1 answer

Python Struggling to create an C extension wrapping a 3rd party dll

We are trying to wrap a 3rd party dll (written in C) to access it through python. The dll has a .lib .c and a .h file with it. We are accessing the dll through the .c file. Outisde of the extension (running as a console application), the code…
user3035260
  • 105
  • 1
  • 9
0
votes
0 answers

How to use Swig typemap for a pointer to struct

I have a C function: int isInPolygon(Point testPoint, Point* polygon, int n); and the point is a simple struct: typedef struct { int x; int y;} Point; Also Polygon is a list of Points.I defined a typemap in interface for Point: %typemap(in)…
Farshid Ashouri
  • 16,143
  • 7
  • 52
  • 66
0
votes
1 answer

How to copy boost python list or his reference with "=" operator

take this code #include namespace bp = boost::python; bp::list py_points; //initial list other_class* C; // this class have a bp::list attribute called py_list // ... some code .... // in this part C.py_list.ptr() is…
ljofre
  • 314
  • 5
  • 18
0
votes
1 answer

Can I use MinGW compiled Python extensions together with Visual C++ compiled ones?

Having trouble compiling a Python extension under Windows, I've asked a question.One of the answers does not answer my question but is worth asking as a question on its own. Given a Visual C++ compiled Python distribution under Windows, would I…
mahonya
  • 9,247
  • 7
  • 39
  • 68
0
votes
2 answers

Can't compile msgpack Python extension under windows

When I try to compile msgpack under windows with visual studio 2008 professional version by doing Python setup.py build I get msgpack/_packer.cpp(316) : fatal error C1083: Cannot open include file: 'stdint. h': No such file or…
mahonya
  • 9,247
  • 7
  • 39
  • 68
0
votes
1 answer

Windows Python C extension only works with my own Python build (32-bit build using VC++ 2008 Express)

I am trying to build a simple Python wrapper for a library we are using. But the weird thing is this extension doesn't work with the official Python build, only with my own Python build. Even though they were based on the same version of source…
Zhe Li
  • 1,103
  • 1
  • 14
  • 20
0
votes
1 answer

taking input to the .c file using pyqt

I have created a c program which requires an input (through scanf). Then I created the .so file and called that in a python script, so that when I run the script, input will be asked in the terminal. But when I run the python program, the terminal…
vineeshvs
  • 479
  • 7
  • 32
0
votes
2 answers

try/catch to avoid .stackdump

In the code below i use try/catch in the python module code. In the try block i have a simple error (memory access violation) and trying to catch the corresponding exception and to terminate the program quietly without generation of the .stackdump…
user938720
  • 271
  • 3
  • 14
0
votes
2 answers

What is the proper usage of PyArg_ParseTuple

I am using what seems to be the exact usgae of PyArg_ParseTuple, yet the code is still failing to work. I am using python 2.7 This is my C code for the Python Extension I am writing: static PyObject* tpp(PyObject* self, PyObject* args) { PyObject*…
Daniel
  • 170
  • 2
  • 11
-1
votes
3 answers

Sporadic segfault in c++ python extension

I have a python object which accesses and downloads some text via HTTP. I'm running this python object, and processing that text, using a c++ code. I.e. /* CPPCode.cxx */ int main(...) { for(int i = 0; i < numURLs; i++) { // Python…
-1
votes
1 answer

segmentation fault Segfault python extension in c++

This extension is used to search data in a linked list and return it as a nested tuple of lists.[(ele1,ele2,),...] However when the program runs for a period of time, segment fault will occur. I know that there might be something I'm missing with…
1 2 3
21
22