DataBuffer не определен, также Calculate_Checksum не определен,
структура должна быть похожа на
Chunk = bytearray(b'\x00') # is it a good idea to use this or any other options?
class Prog:
PROGRAMMING_FLAG = False
SET_ADD_FLAG = False
DATA_FLAG = False
ADD_COMMAND_FLAG = False
ERASE_FLAG = False
ATTEMPT = 1
def prog_flash(Chunk):
try:
Prog.DATA_BUFFER = []
Prog.ADD_COMMAND_FLAG = True
Prog.DATA_BUFFER.append(hex(0x02))
No_Of_Bytes = Chunk * 64
for index in range(0,64):
Prog.DATA_BUFFER.append(hex(DataBuffer[No_Of_Bytes+index]))
Prog.DATA_BUFFER.append(hex(Calculate_Checksum(Prog.DATA_BUFFER[1:Prog.DATA_BUFFER.__len__()])))
Prog.DATA_FLAG = True
return Prog.DATA_BUFFER
except Exception, e:
# handle Expection
print "There was an error: %s" %(e)
pass
def other_fn():
prog_flash(Chunk)
if __name__ == '__main__':
other_fn()