FW: Comunicating through COM ports

Kevin Cazabon kevin at cazabon.com
Fri Dec 21 12:50:12 EST 2001


If you want simple access to Serial ports, try the "uspp" module
written by Isaac Barona: 
http://balder.prohosting.com/ibarona/en/python/uspp/uspp_es.html

I've been playing with it, and it's VERY simple to use... the posted
version needs one small modification for W2k/Python 2.1.1, but the
author is currently fixing that.

FYI, the mod is:  comment out / remove the reference to
"win32con.FILE_FLAG_OVERLAPPED" in the SerialPort_win.py module.

Kevin Cazabon.


"Alves, Carlos Alberto - Coelce" <calves at coelce.com.br> wrote in message news:<mailman.1008940586.10914.python-list at python.org>...
> Thanks for the example. But, where can I find such module Serial?!
> 
> -----Original Message-----
> From: David Mallwitz [mailto:dmallwitz at cox.rr.com] 
> Sent: Thursday, December 20, 2001 10:26 PM
> To: python-list at python.org
> Subject: Re: Comunicating through COM ports
> 
> 
> 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