Recently, I have a chance to use pylint, an analyzer of Python codes. Usually, you would use it's command-line program to generate analysis reports. However, we — people I recently work with for a game development — import pylint and generate in a script, then immediately parse the reports.

That cost me some time. I can't figure out why I open the report (pylint_global.txt), and get no content from it. Finally, I guess pylint doesn't close files, and it doesn't. Here is a simple program to show your:
#!/usr/bin/python


"""Find out how many files that pylint left opend"""

import __builtin__
import sys

from pylint import lint
import time

def main():
"""Main function"""

# Dirty job to close pylint left opened
original_open = __builtin__.open

f_handlers = []
def count_open(*args, **kwargs):
"""Counts how many file opened"""
f_handler = original_open(*args, **kwargs)
f_handlers.append(f_handler)
return f_handler

__builtin__.open = count_open

lint.Run(['-ftext', '--files-output=y', sys.argv[0]])
# Run lsof here
time.sleep(30)
# Restore the original file open
__builtin__.open = original_open

opened = len(f_handlers)
closed = sum([f_handler.closed for f_handler in f_handlers])
print 'Open: %d, unclosed %d.' % (opened, opened - closed)


if __name__ == '__main__':
main()

A sample output:
$ python pylint_open.py
No config file found, using default configuration
Open: 9, unclosed 9.

Here is related result from lsof:

python  32310 livibetter    3r   REG  253,0      870 4554767 /home/livibetter/tmp/pylint_open.py
python  32310 livibetter    4w   REG  253,0        0 4554764 /home/livibetter/tmp/pylint_pylint_open.txt
python  32310 livibetter    5r   REG  253,0      870 4554767 /home/livibetter/tmp/pylint_open.py
python  32310 livibetter    6r   REG  253,0      815 1221017 /usr/lib/python2.5/site-packages/pylint-0.15.2-py2.5.egg/pylint/__init__.py
python  32310 livibetter    7r   REG  253,0    38194 1221015 /usr/lib/python2.5/site-packages/pylint-0.15.2-py2.5.egg/pylint/lint.py
python  32310 livibetter    8r   REG  253,0    16986 1221710 /usr/lib/python2.5/site-packages/pylint-0.15.2-py2.5.egg/pylint/checkers/rpython.py
python  32310 livibetter    9r   REG  253,0        0 3768605 /home/livibetter/.pylint.d/pylint_open1.stats
python  32310 livibetter   10w   REG  253,0        0 4554766 /home/livibetter/tmp/pylint_global.txt
python  32310 livibetter   11w   REG  253,0        0 3768605 /home/livibetter/.pylint.d/pylint_open1.stats

You should look at *.txt. That means pylint doesn't close files after it finishes its job. I tried to report but I can't find a link to sign up or to file a report.