Serial port failure
Leo Kislov
Leo.Kislov at gmail.com
Sat Dec 16 00:34:16 EST 2006
Rob wrote:
> try:
> response = p.readline()
> except SerialException:
> print ">>>>>Timed out<<<<<"
> try:
> port.writelines(msg)
> except OSError:
> print "Serial port failure. Power cycle units"
> port.close()
> sys.exit(1)
>
> Does anyone have any ideas?
It'd be a good idea to print all exceptions, it can help debugging the
problem (if you don't like it going to the screen of an end user at
least write it to a log file):
except SerialException, err:
print err
print ">>>>>Timed out<<<<<"
except OSError, err:
print err
print "Serial port failure. Power cycle units"
and in your OpenPort function too.
-- Leo
More information about the Python-list
mailing list