How can I enumerate (list) serial ports?

Jason jason.heeris at gmail.com
Wed Jun 17 22:40:25 EDT 2009


Hi,

I'm developing an application to talk to a device over a serial port.
I'm trying my hardest to keep it cross platform, so I was using
pySerial for the serial communications. But I can't see a pythonic,
cross-platform way to enumerate serial ports on a machine.

Ideally I could show the user a list of "COM1","COM2", etc, or ttyS0,
ttyS1, etc. At the moment I think they'll just have to type it into a
box.

Is there a known way to do this? Is there anyone who has a hack
they're willing to share?

Thanks,
Jason



More information about the Python-list mailing list