>>> import serial >>> ser = serial.Serial('/dev/ttyS0', 2400, timeout= 10, bytesize=8, stopbits=1) >>> a = ser.read(1) >>> print a ^ >>> ser.close()
>>> type(a) <type 'str'> >>> int(a, 16) Traceback (innermost last): File "<stdin>", line 1, in ? ValueError: invalid literal for int(): ^ so i run it again the same way, only reading 4 bytes this time. >>> ser = serial.Serial('/dev/ttyS0', 2400, timeout= 10, bytesize=8, stopbits=1) >>> a = ser.read(1) >>> print a ^AÜÀ >>> ser.close() >>> type(a) <type 'str'> int(a, 16) Traceback (innermost last): File "<stdin>", line 1, in ? ValueError: invalid literal for int(): ^AÜÀ i dont understand what i am missing here. the string character represents a hex character. -- http://mail.python.org/mailman/listinfo/python-list