473,769 Members | 5,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c_string missing from ctypes?

Hello,

I was following along with this site:

http://www.brunningonline.net/simon/...es/000659.html

and I got a error. It boils down to:

=============== =====

In [9]: import ctypes
In [10]: dir(ctypes.c_st ring)
---------------------------------------------------------------------------
<type 'exceptions.Att ributeError' Traceback (most recent call
last)

P:\<ipython consolein <module>()

<type 'exceptions.Att ributeError'>: 'module' object has no attribute
'c_string'

=============== =====
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.

Also:

http://starship.python.net/crew/thel.../tutorial.html

seems dead.

An info is greatly appreciated.

jr

Feb 23 '07 #1
2 3376
On 23 Feb 2007 09:03:21 -0800, Jacob Rael <ja********@gma il.comwrote:
Hello,

I was following along with this site:

http://www.brunningonline.net/simon/...es/000659.html

and I got a error. It boils down to:

=============== =====

In [9]: import ctypes
In [10]: dir(ctypes.c_st ring)
---------------------------------------------------------------------------
<type 'exceptions.Att ributeError' Traceback (most recent call
last)

P:\<ipython consolein <module>()

<type 'exceptions.Att ributeError'>: '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/thel.../tutorial.html

seems dead.

An info is greatly appreciated.

jr

--
http://mail.python.org/mailman/listinfo/python-list
Feb 23 '07 #2
On 23 Feb 2007 09:03:21 -0800, Jacob Rael <ja********@gma il.comwrote:
I was following along with this site:

http://www.brunningonline.net/simon/...es/000659.html
You don't want to be messing around with that old rubbish. I should
know - I wrote it.

Instead, take a look at <http://www.openqa.org/pywinauto/>.
In [9]: import ctypes
In [10]: dir(ctypes.c_st ring)
---------------------------------------------------------------------------
<type 'exceptions.Att ributeError' Traceback (most recent call
last)
<type 'exceptions.Att ributeError'>: 'module' object has no attribute
'c_string'
I think that c_string has been replaced by c_buffer in recent versions
of ctypes.

--
Cheers,
Simon B
si***@brunningo nline.net
http://www.brunningonline.net/simon/blog/
Feb 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
2502
by: Thomas Heller | last post by:
ctypes 0.9.2 released - Oct 28, 2004 ==================================== Overview ctypes is a ffi (Foreign Function Interface) package for Python 2.3 and higher. ctypes allows to call functions exposed from dlls/shared libraries and has extensive facilities to create, access and manipulate
2
2091
by: rrenaud | last post by:
Is there a reason why erf() is not included in the math package? According to the following URL it looks like it has been standard C since 1999. http://www.opengroup.org/onlinepubs/000095399/functions/erf.html
1
4726
by: sjdevnull | last post by:
Hey, I'm trying to wrap GNU readline with ctypes (the Python readline library doesn't support the callback interface), but I can't figure out how to set values to a variable inside the library. This is Python 2.5 on Linux. Here's what I have so far--if you comment out the memmove call (3 lines) it works as expected: # START #!/usr/local/bin/python2.5
7
7038
by: p.lavarre | last post by:
How do I vary the byte offset of a field of a ctypes.Structure? How do I "use the dynamic nature of Python, and (re-)define the data type after the required size is already known, on a case by case basis"? \\\ For example, suppose sometimes I receive the value '\x03hi' + \x04bye' for the struct:
6
12923
by: Jack | last post by:
I'm not able to build IP2Location's Python interface so I'm trying to use ctypes to call its C interface. The functions return a pointer to the struct below. I haven't been able to figure out how I should declare the return type of the functions and read the fields. Any hint is appreciated. typedef struct { char *country_short; char *country_long;
0
2560
by: Egor Zindy | last post by:
Egor Zindy wrote: #!/usr/bin/env python """ A generic chipid library based on ctypes This module handles most of the functions in FTChipID.dll
3
11665
by: Andrew Lentvorski | last post by:
Basically, I'd like to use the ctypes module as a much more descriptive "struct" module. Is there a way to take a ctypes.Structure-based class and convert it to/from a binary string? Thanks, -a
4
3162
by: taghi | last post by:
I want to call NetShareEnum, a function from netapi32.dll NetShareEnum has this definition: NET_API_STATUS NetShareEnum( __in LPWSTR servername, __in DWORD level, __out LPBYTE *bufptr, __in DWORD prefmaxlen, __out LPDWORD entriesread, __out LPDWORD totalentries,
0
1238
by: Tim Grove | last post by:
Thanks Martin (and others) for your advice. No, this solution didn't quite work either. Well, the extremely annoying thing is that it DOES work on another home pc, but on my laptop which I use for work, it doesn't want to know!!! Both are running WinXP Pro. All the dependencies and paths "seem" to be okay, but there must still be something that I'm missing. Tim
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.