ttySx

Marco Mariani marco at sferacarta.com
Fri Sep 6 11:54:30 EDT 2002


On Fri, Sep 06, 2002 at 05:24:18PM +0200, Marco Mariani wrote:

> Here it is.
> Of course, the code is old and sucks. If you have problems with lock
> files, I don't want to know :-)

I forgot an example.

Hope it helps.




import modem
import sys

if len(sys.argv)==3:
    command = sys.argv[2]
    serial = sys.argv[1]
else:
    sys.exit(1)


mod = modem.Modem(serial)
if not mod.open() and not mod.term_init():
    mod.set_speed(2400)
    if not mod.sendline(command):
        for i in mod.answer:
            print i
        mod.purge()
        sys.exit(0)
mod.purge()

sys.exit(1)





More information about the Python-list mailing list