python - IndexError: list index out of range when running on ubuntu -


i getting indexerror: list index out of range while reading register values description in following code.

import os, sys, csv  path_map = "./desc.csv" cmd_e2 = "./ext_desc.txt" e_bytes = 512  result_path = "./result/" f_e_mapping = open(path_map, 'r')  val_e = os.popen(cmd_e2).readline()[:-2]  curpos = e_bytes*2 write_result.writerows(('', '')) write_result.writerow(('', '', 'ecxstd')) line_e in f_e_mapping:     tok_e = line_e[:-1].split(",")     print (tok_e)     try:         cursize = int(tok_e[2], 10)         value = ""         xy in range(0, cursize):             curpos = curpos - 2             value = value + val_e[curpos: curpos + 2]     except valueerror:         value = ""      # strip off right number of bytes     write_result.writerow((tok_e[0], tok_e[1], tok_e[2], tok_e[3], tok_e[4], value)) 

please in resolving indexerror seen in line cursize = int(tok_e[2], 10)


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -