[Pythonmac-SIG] character buffer

Bob Ippolito bob at redivi.com
Fri Mar 5 15:20:38 EST 2004


On Mar 5, 2004, at 3:01 PM, Greg Hoover wrote:

> How do you create character buffers in Python?  I'm trying to send 
> data to a native function using the "t#" ParseTuple type.

These questions are probably better asked on another one of the Python 
lists, or the comp.lang.python newsgroup.  The Python C API is not 
Macintosh specific, and the problems you're experiencing (whatever they 
are, you really aren't giving a whole lot of detail) are not platform 
specific either.

Python is open source, and clearly there are parts of python that do 
what you're trying to do (for example, the socket module probably 
does), so you can just look at that.

Just a hunch, but it sure sounds like what you're trying to do is 
already possible in some other way (not writing an extension in C).  
For example, if you're talking to serial ports, that can be done 
through file descriptors (i.e.: open('/dev/something')) and is all of 
the nasty bits are abstracted by PySerial or the like.  I've written 
pure python code that talks to serial devices on 
win32/linux/osx/jython, and I have never had to dig into C because 
other people had already done it (win32) or you can do it using 
standard means (/dev files).

-bob




More information about the Pythonmac-SIG mailing list