Serial Port

David Brown david at no.westcontrol.spam.com
Mon Nov 18 06:06:38 EST 2002


"Grant Edwards" <grante at visi.com> wrote in message
news:3dd514e8$0$4448$a1866201 at newsreader.visi.com...
> In article <3dd47570$1 at news.nz.asiaonline.net>, Colin Brown wrote:
> >
> > Hi Luca
> >
> > Try PySerial - a nice multiplatform solution
>
> On a slight tangent, anybody know where there's documentation
> or examples of doing stuff like overlapped serial I/O under
> Win32 with events and callbacks and suchlike in Python?  I
> haven't found a copy of the Python on Win32 book yet...
>
> --

I find it easier to run serial communication in a seperate thread if I need
asynchronous communication.  You don't normally have so many serial ports
open at a time that the threading overhead is significant, it is much easier
than messing with the overlapped I/O stuff, and it is platform-independant.
To be entirely honest, though, the couple of Python programs I have written
so far that use the serial port have not bothered with threading either -
they just send out something, and wait for a reply or timeout (using the
inWaiting() function from pyserial, along with time.sleep).  But if I needed
something more advanced, then I *would* use threads - I've done it in
Delphi, and it works fine.







More information about the Python-list mailing list