[Pythonmac-SIG] Python access to RS-232, USB, MIDI?

Bob Ippolito bob at redivi.com
Fri Jan 14 03:51:09 CET 2005


On Jan 13, 2005, at 21:10, Lance Boyle wrote:

> I'm brainstorming on a project that involves communicating with a head 
> tracker (I need only azimuth). I haven't decided on an actual head 
> tracker, but am looking at a Polhemus. (Comments on head trackers are 
> also welcomed--gaming devices or 3D mice?)
>
> It looks like that I might need to communicate via RS-232 or USB (is 
> there a MIDI tracker?). I want to keep this simple and clobber the 
> problem with minimum fuss, so naturally I think of Python, 
> AppleScript, etc. I'm pretty much a neophyte with such things 
> (although I wrote a 3D plotting program for a Tektronix pen plotter a 
> _long_ time ago).
>
> So--can Python help me? AppScript?

appscript / AppleScript isn't really going to do anything for you.

Python can talk to serial devices just fine using pySerial.  I'd 
recommend against using something other than serial because it will be 
more work.  USB<->Serial converters work just fine, of course.  I've 
done it with pySerial + Twisted for GPS devices and proprietary packet 
data modems, but it works fine with just pySerial if you don't mind 
blocking.

Alternatively you can buy a serial<->TCP/IP box and just write it like 
any other network app with a line-based TCP protocol.

-bob



More information about the Pythonmac-SIG mailing list