Out of range index list on 'file' object - Python
I have a text file reval2_log.txt
that contains data like
yield_curve on;DATE_val 2013 12 31;arion on;INFL_filn /srv/www/tbg/file/1/2014-07-21/Vaxtaferlar_nidur.csv;ASSETS_filn /srv/www/tbg/file/1/2014-07-21/Vordur_VT.xls;REVAL_filn kfjh.xls;CPI_value 416.7;LSK_value 8022.3;YIELDC_filn /srv/www/tbg/file/1/2014-07-21/infl.csv;CASHF_filn weouhf.xls;sjf on;user 1
Then I will do the following:
f = open('reval2_log.txt', 'r')
read = f.readlines()[0].split(";")
And he returns IndexError
. Of course, Python can find the file, because it doesn't return a file not found error (which it does if I mangle the filename).
Trace:
File "/srv/www/tbg/notendur/views.py" in reikna_reval2
79. reval2.main(user)
File "/srv/www/tbg/calc/reval2.py" in main
322. read = f.readlines()[0].split(";")
Exception Type: IndexError at /notendur/reikna/
Exception Value: list index out of range
+3
source to share