Another option might be to wrap your C code using the ctypes module ( http://starship.python.net/crew/theller/ctypes/).  This might be especially attractive if this code is mostly for demo purposes (at least for demo purposes on win32).  Ctypes basically allows you to call C code from python, but rather than handling the data type translations in C (like in a "normal" extension), you handle the translations in Python.

For C++ code you might check out boost.python.  I haven't used it but I've heard good things.

Kevin H.


On 6/15/06, James Carroll < [EMAIL PROTECTED]> wrote:
Hi Chris,

I would recommend buying Visual Studio.  It's what python 2.4 is built
with, and it makes compiling extensions nice and easy.

My favorite examples of extending python include:

- screengrabber extension for the python imaging library
   http://effbot.org/downloads/

1) download and install the Python imaging library (PIL)
2) download the screengrabber source and uncompress to a directory.
3) look at the _screengrab.c (or whatever it is called) to see how it
accepts and returns python argumetns, but does win32 calls inbetween.
4) run " python setup.py build " to invoke Visual C++ (or mingw if detected.)
5) run " python setup.py install " to try it interactively.

- My second favorote example is on the wxPython Wiki, it shows how to
extend wxPython with commercial VC++

   http://wiki.wxpython.org/index.cgi/C%2B%2BExtensions

I wrote the pages for VisualStudioExtenions and SconsExtensions, so
let me know if you need them to be more helpful.  I wrote them
hastily, but I think I got the important parts right.

-Jim




On 6/15/06, chris botos <[EMAIL PROTECTED]> wrote:
>
> This sounds like a plan.  I'll give it a try.  Thanks, Paul.
>
> Chris
>
>
>
>
> On 6/15/06, Paul Moore <[EMAIL PROTECTED]> wrote:
> > On 6/15/06, Chris Botos < [EMAIL PROTECTED] > wrote:
> > > 3)  I downloaded and installed:
> > > .NET Framework SDK Version 1.1
> > > Visual C++ 2005 Express Edition, that first installs .NET Framework 2.0
> > >   (note that I could not get to a download for the 2003 version on
> > > Microsoft's site and the only other download site I found was at
> > > softpedia, and the download link there is broken )
> >
> > I've only skimmed your post briefly, but this is likely your problem.
> > Python extensions cannot be built with Visual C++ 2005 (incompatible C
> > runtime), so this doesn't work. You need the Visual C++ Toolkit
> > Edition, but MS no longer seem to supply this :-( If you can get
> > someone who has a copy to send it to you, that would be one option -
> > but it's a 32MB file, and I don't know the redistribution conditions,
> > it's probably not allowed, so you may have problems there).
> >
> > The other option is to install Mingw (from www.mingw.org), and build
> > using setup.py build --compiler=mingw32. This works fine, unless your
> > extension code uses MSVC specific extensions. The instructions in the
> > Python docs are a little out of date, I believe. With Python 2.4, you
> > shouldn't need to do anything more than install mingw, make sure gcc
> > is on your path, and run setup.py as above. You can even edit the
> > distutils config file (I can't remember its location offhand, sorry)
> > to specify that distutils should use mingw by default.
> >
> > Hope this helps,
> > Paul.
> >
>
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
>
>
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to