Reputation: 415
I'm working on a script that reads in a text and processes, pretty straight forward stuff I do all the time. However, this time it only reads in about 512 lines of a file that is tens of thousands of lines long. The file doesn't look truncated or anything so there must be a stray EOF
in the file. How do I work around this? Here is a little code snippet I put together to troubleshoot this:
objFileIn = open(strFilein, "r")
strJson = objFileIn.read()
objFileOut = open(strFixedjason,"w")
objFileOut.write(strJson)
objFileOut.close()
objFileIn.close()
strFilein
points to a json file that is 20,550 lines long. strFixedjason
has 512 lines in it.
Upvotes: 0
Views: 296
Reputation: 415
OK this is totally embarrassing, turns out I wasn't feeding the script the file I thought I was processing :-( I two files with the exact same name in two different directories, one was 512 lines the other 20K lines. I pointed the script at the smaller one and looked at the other in the editor. You can classify this question as caused by stupid human error. :-P
Upvotes: 1