<s> import sys <EOL> from bibliopixel . drivers . serial_driver import DriverSerial <EOL> run = True <EOL> print "<STR_LIT>" <EOL> try : <EOL> while run : <EOL> ignored = raw_input ( <EOL> "<STR_LIT>" ) <EOL> ports = DriverSerial . findSerialDevices ( ) <EOL> if len ( ports ) : <EOL> try : <EOL> id = DriverSerial . getDeviceID ( ports [ <NUM_LIT:0> ] ) <EOL> print "<STR_LIT>" . format ( ports [ <NUM_LIT:0> ] , id ) <EOL> newID = raw_input ( "<STR_LIT>" ) <EOL> if newID != '<STR_LIT>' : <EOL> try : <EOL> newID = int ( newID ) <EOL> if newID < <NUM_LIT:0> or newID > <NUM_LIT:255> : <EOL> raise ValueError ( ) <EOL> try : <EOL> DriverSerial . setDeviceID ( ports [ <NUM_LIT:0> ] , newID ) <EOL> print "<STR_LIT>" . format ( DriverSerial . getDeviceID ( ports [ <NUM_LIT:0> ] ) ) <EOL> except : <EOL> pass <EOL> except ValueError : <EOL> print "<STR_LIT>" <EOL> except Exception , e : <EOL> print e <EOL> else : <EOL> print "<STR_LIT>" <EOL> except KeyboardInterrupt , err : <EOL> pass <EOL> else : <EOL> pass </s>
