To help us out, mark line numbers in source when referred to in error messages.
–
outisMay 6 '10 at 4:12

Any chance you could link to a sample file we could use to reproduce the error?
–
David ZMay 6 '10 at 4:18

@kartiku: What are you using to debug? If you're having problems with the inner functions, move them outside try_read_file and loading everything as a module to make debugging easier.
–
outisMay 6 '10 at 4:36

Offhand, noOfCols comes from column_counter(), which returns the value of the local tmpLength. If tmpLength wasn't an integer, it would be either because feature_ids[-1] wasn't an integer or the for line in inputer loop body was never entered. On second thought, both those scenarios should result in a different exception than what was seen.

I don't know by you're being shown print noOfCols as line 52 -- I make it line 47 in your code. Line 50's the closest one where an integer is required:

feature_array = scipy.zeros((noOfRows,noOfCols), float)

Your code is truly peculiar, e.g. the for loop ending with

loopexit = loopexit + 1
if loopexit > 0:
break

which, given that loopexit is set to 0 just before the loop, is the weirdest way I've ever seen to unconditionally exit a loop -- and a for loop that unconditionally ends at the end of the first leg is, essentially, not a loop at all. But these utter weirdness samples still don't explain your bug, and especially why the line number and source code being shown as the point of exception don't match. What do those print statements you have show?

Ok, I don't know what the problem was. When I started up Python again it was not giving this error.

I don't know what happened in between and what caused those errors. It's a mystery to me. Of course, now the array i was trying to put these values has "dimensions too large" and I'm getting a ValueError. I'll probably split the array.

The line number mismatch is probably due to some after-editing.
Ya, the for loop exit is weird i just needed to see if it works so was a quick workaround since i'm not familiar with python at all.