is there a problem on this simple code

jrlen balane nbbalane at gmail.com
Tue Mar 15 10:43:35 CET 2005


did some editing:

rx_data = ser.read(19)
byte[0:18] = unpack('19B', rx_data)

   for k in range(9):
       if byte[k] == 70:
           if byte[k+2] == 6:
               if byte[k+9] ==
-(byte[k]+byte[k+1]+byte[k+2]+byte[k+3]+byte[k+4]+byte[k+5]+byte[k+6]+byte[k+7]+byte[k+8])
& 0xff:
                   print byte[k:k+9]
====================================
heres the error:
Traceback (most recent call last):
  File "C:\Python23\practices\serialnewesttest2.py", line 28, in -toplevel-
    byte[0:18] = unpack('19B', rx_data)
error: unpack str size does not match format

what i am doing here is creating an array from based on the unpacked data
then i am searching for the array member that is equal to "70" since
it is going to be my reference. once i find it, i'll based my received
data from that point. then if the succeding tests are confirmed, i can
get my data.

please help....(again) :(



More information about the Python-list mailing list