swig

Is there any way to use pythonappend with SWIG's new builtin feature?

Is there any way to use pythonappend with SWIG's new builtin feature? Question: I have a little project that works beautifully with SWIG. In particular, some of my functions return std::vectors, which get translated to tuples in Python. Now, I do a lot of numerics, so I just have SWIG convert these to numpy arrays …

Total answers: 1

M2Crypto doesn't install in venv, or swig doesn't define __x86_64__ which breaks compiling against OpenSSL

M2Crypto doesn't install in venv, or swig doesn't define __x86_64__ which breaks compiling against OpenSSL Question: I’m trying to install the Python M2Crypto package into a virtualenv on an x86_64 RHEL 6.1 machine. This process invokes swig, which fails with the following error: $ virtualenv -q –no-site-packages venv $ pip install -E venv M2Crypto==0.20.2 Downloading/unpacking …

Total answers: 10

Can I use generated swig code to convert C++ object to PyObject?

Can I use generated swig code to convert C++ object to PyObject? Question: I’m working on embedding python into my C++ program using swig. At the moment I have a object written in C++ which I want to pass to a python function. I’ve created the swig interface to wrap the class. What I’m trying …

Total answers: 1

Easiest way of unit testing C code with Python

Easiest way of unit testing C code with Python Question: I’ve got a pile of C code that I’d like to unit test using Python’s unittest library (in Windows), but I’m trying to work out the best way of interfacing the C code so that Python can execute it (and get the results back). Does …

Total answers: 2

Extending python – to swig, not to swig or Cython

Extending python – to swig, not to swig or Cython Question: I found the bottleneck in my python code, played around with psycho etc. Then decided to write a c/c++ extension for performance. With the help of swig you almost don’t need to care about arguments etc. Everything works fine. Now my question: swig creates …

Total answers: 10

Exposing a C++ API to Python

Exposing a C++ API to Python Question: I’m currently working on a project were I had to wrap the C++ classes with Python to be able to script the program. So my specific experience also involved embedding the Python interpreter in our program. The alternatives I tried were: Boost.Python I liked the cleaner API produced …

Total answers: 5

Prototyping with Python code before compiling

Prototyping with Python code before compiling Question: I have been mulling over writing a peak-fitting library for a while. I know Python fairly well and plan on implementing everything in Python to begin with but envisage that I may have to re-implement some core routines in a compiled language eventually. IIRC, one of Python’s original …

Total answers: 7