Comunicating through COM ports

Isaac Barona ibarona at tid.es
Fri Dec 21 15:40:33 CET 2001


You can try the uspp (Universal Serial Port Python Library).

You can download it from:
http://balder.prohosting.com/ibarona/en/python/uspp/uspp_en.html

Isaac.


On Thu, 20 Dec 2001 20:25:46 -0500, "David Mallwitz"
<dmallwitz at cox.rr.com> wrote:

>Comunicating through COM portsChapter 19 of Mark Hammond and Andy Robinson's
>'Python Programmingon on Win32' covers this quit well, and with the
>Activestate Python distro there is a multithreaded demo called
>'win32comport_demo.py'. But here's what I do - example is from a console
>connection to an old Cisco router.
>
>>>> from Serial import Serial
>>>> ### open the COM1 port
>>>> serialconfig = Serial.PortDict()
>>>> serialconfig['port'] = Serial.COM1
>>>> serialconfig['rxBufSize'] = 4096
>>>> port = Serial.Port(serialconfig)
>>>> port.open()
>>>> port.write('show conf \r')
>>>> x = port.read()
>>>> x
>'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno
>service u
>dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname
>Router\r\n!\r\
>n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n
>link-test\
>r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n
>auto-polarity\r\n!\r\n
>hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- '
>
>Best,
>Dave
>
>
>"Alves, Carlos Alberto - Coelce" <calves at coelce.com.br> wrote in message
>news:mailman.1008852145.28654.python-list at python.org...
>Anybody could give me an example code of how connect/comunicate through COM
>ports (i.e. COM1, COM2). I'm under windows 98.
>Thanks!!!
>Carlos Alberto
>COELCE/DPRON-Departamento de Projetos e Obras Norte
>Fone: 677- 2228
>e-mail: calves at coelce.com.br
>\|||/
>(o o)
>--ooo0-(_)-0ooo--
>
>
>
>
>-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
>http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> Check out our new Unlimited Server. No Download or Time Limits!
>-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----




More information about the Python-list mailing list