a serial port module for the Mac?

Jacob Kaplan-Moss jacobkm at dont.spam.me.cats.ucsc.edu
Tue Apr 17 18:57:17 EDT 2001


In article <9bhmpt$9829g$1 at ID-63368.news.dfncis.de>, "Hans Löffler" 
<loeffler at multichannelsystems.com> wrote:

> Is there something like the Serial package for Windows for the Mac around?
> 
> Hans
> 
> 

The ctb module is what you are looking for.

Try the following:

Python 2.1b2 (#90, Mar 26 2001, 21:40:11)  [CW PPC GUSI2 THREADS] on mac
Type "copyright", "credits" or "license" for more information.
>>> import ctb
>>> p = ctb.CMNew("Serial Tool", None)
>>> p.GetConfig()
'Baud 9600 DataBits 8 Parity None StopBits 1 Port "Infrared Port" 
Handshake None HoldConnection False RemindDisconnect False'
>>> p.SetConfig('Baud 2400 DataBits 7 Parity Odd Port "Modem Port"')
38
>>> p.GetConfig()
'Baud 2400 DataBits 7 Parity Odd StopBits 1 Port "Modem Port" Handshake 
None HoldConnection False RemindDisconnect False'
>>> p.Open(0)
>>> p.Write("Some text", 0, 0, 0)

For more info, see <http://python.org/doc/current/mac/module-ctb.html>

It's pretty easy once you get the hang of it.

HTH,

Jacob



More information about the Python-list mailing list