opening a serial port at a given baudrate. How?

David Arnold arnold at
Tue Apr 4 07:53:27 EDT 2000

-->"Jim" == Jim Richardson <warlock at> writes:

  Jim> I can't seem to find any info on opening a serial port in
  Jim> python!. (I am using linux for developement, but would like to
  Jim> be able to use the app on any python system, it is text only,
  Jim> no gui, at least for now. )

there is no portable way to open a serial port.  this is not least
because there is no portable way to name your serial ports, but goes
further than that.

on unix (including linux), just open the device special file
corresponding to the serial port of interest (ie. /dev/ttyS0) and you
can then control it using fcntl.ioctl() function and otherwise read
from and write to it like a normal file object.

on win32 there is a serial I/O module (serialmodule?) that a quick
deja search will locate for you.

i'd recommend the POSIX serial programming guide (any search engine
should find it) as a good primer for Unix serial programming ...


More information about the Python-list mailing list