ffi

How to expose a Python package to C# using python .Net vs ZeroMQ or other

How to expose a Python package to C# using python .Net vs ZeroMQ or other Question: I am developing an application which is written in Python3 and is composed of a Python library/package (which contains the core functionality) and a Python application which will provide a cli shell and handles user commands. In addition the …

Total answers: 2

Python 3 replacement for PyFile_AsFile

Python 3 replacement for PyFile_AsFile Question: The following code works in Python 2: from ctypes import * ## Setup python file -> c ‘FILE *’ conversion : class FILE(Structure): pass FILE_P = POINTER(FILE) PyFile_AsFile = pythonapi.PyFile_AsFile # problem here PyFile_AsFile.argtypes = [py_object] PyFile_AsFile.restype = FILE_P fp = open(filename,’wb’) gd.gdImagePng(img, PyFile_AsFile(fp)) But in Python 3, there …

Total answers: 3

Passing Numpy arrays to a C function for input and output

Passing Numpy arrays to a C function for input and output Question: Oh my word I’m a fool. I was simply omitting the second and third arguments when calling the function. Like a fool. Because that’s what I am. Original silly question follows: This seems like it must be a very common thing to do, …

Total answers: 2

Calling Haskell functions from Python

Calling Haskell functions from Python Question: I want to use some Haskell libraries (e.g. Darcs, Pandoc) from Python, but it seems there’s no direct foreign function interface to Haskell in Python. Is there any way to do that? Asked By: minhee || Source Answers: Provided you can get your Python code to call C, you …

Total answers: 6