I have an application where I need to use the serial module. My problem is this I have a client application that uses three serial ports to communicate with peripherial devices. When I start the application I open the serial ports and start a client timer script that periodically sends querys to the peripherial to get status on several parameters. Since I have multiple clients and each may designate the serial ports differently ie ‘COM4’,‘COM5’,'COM3" vs ‘COM2’,‘COM7’,‘COM8’. in order to not have client specific code I tried to use an initialization data table to query and get the client specific port configuration. This did not work. I think that I am getting an extra character in the string when I query it. I have tried strip and regular expressions but do not seem to be having much sucess. I have had to return to hard coded constants to get it to work. Ultimately I would like to get away from this as it is a source of error when making changes and is not very scalable.
After some investigation I think the problem has to do with the unicode as the list comes out like this [u’COM4’,u’COM5’,u’COM6’]. The peripherial specfically uses ascii so I will encode the data as ascii and then see what happens.