Calling a C program from a Python Script

Grant Edwards grante at visi.com
Thu Dec 9 14:48:42 EST 2004


On 2004-12-09, Brad Tilley <bradtilley at gmail.com> wrote:

> I just want to know the basics of using C and Python together
> when the need arises, that's all, I don't want to write a book
> about what exactly it is that I'm involved in.
>
> I'm going to take It's Me's advice and have a look at SWIG.

There's also the ctypes module that lets you load and call
library functions written in C (or anything else with C calling
conventions).  IMO, it's a bit easier to use than SWIG, since
you don't have to actually generate/install any python modules
to use it.

But, neither SWIG nor cypes has anything to do with executing a
_program_ written in C, which is what I thought you were asking
about... 

-- 
Grant Edwards                   grante             Yow!  I had pancake makeup
                                  at               for brunch!
                               visi.com            



More information about the Python-list mailing list