Convert an int value to unicode
I am using pyserial and need to send some values less than 255. If I send the int itself the the ascii value of the int gets sent. So now I am converting the int into a unicode value and sending it through the serial port. unichr(numlessthan255); However it throws this error: 'ascii' codec can't encode character u'\x9a' in position 24: ordinal not in range(128) Whats the best way to convert an int to unicode? Just use chr(somenumber) to get a 1 byte value of an int as long as it is less than 256. pySerial will then send it fine. If you are looking at sending things over pySerial it is a very