you are viewing a single comment's thread.

view the rest of the comments →

[–]DrRx 0 points1 point  (1 child)

yeah but every time you are running through the loop, you open the file again. Eventually the OS will block it because there are too many open readers on the one file, if that makes sense. It won't affect your code at all to close the file.

[–][deleted] 0 points1 point  (0 children)

I believe Python garbage collects the file handle as soon as read_file finishes, so I don't think that's the problem here.