c_string missing from ctypes?

Chris Mellon arkanes at gmail.com
Fri Feb 23 12:12:21 EST 2007


On 23 Feb 2007 09:03:21 -0800, Jacob Rael <jacob.rael at gmail.com> wrote:
> Hello,
>
> I was following along with this site:
>
> http://www.brunningonline.net/simon/blog/archives/000659.html
>
> and I got a error. It boils down to:
>
> ====================
>
> In [9]: import ctypes
> In [10]: dir(ctypes.c_string)
> ---------------------------------------------------------------------------
> <type 'exceptions.AttributeError'>        Traceback (most recent call
> last)
>
> P:\<ipython console> in <module>()
>
> <type 'exceptions.AttributeError'>: 'module' object has no attribute
> 'c_string'
>
> ====================

The tutorial is out of date, ctypes.c_string was removed somewhere
around version 0.6 (theres a comment to this effect in the comments
under the tutorial). You want ctypes.c_buffer instead.

>
>
> I google ctypes.c_string and many people use it.
>
> I am using python 2.5 with ctypes version: 1.0.1  on a windows
> machine.
>
> I have to admit I don't know where ctypes came from. I tried to re-
> install it but the window binaries only support 2.4.
>

As of Python 2.5 ctypes is part of the standard library.

> Also:
>
> http://starship.python.net/crew/theller/ctypes/tutorial.html
>
> seems dead.
>
> An info is greatly appreciated.
>
> jr
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list