I've checked and double checked my code and I am closing all files explicitly after opening them. The only possibliy I can think of is Python opening files each time I run a script, or each time imput to stderr or stdout is redirected.
Here's a link that is perhaps related to my problem:<http://pyfaq.infogami.com/why-doesn-t-closing-sys-stdout-stdin-stderr-really-close-it> Here is a thread in this group, see post by alisonken1:<http://groups.google.com/group/comp.lang.python/browse_thread/thread/75e65baa1a51b3a6/512bba0739924917?q=too+many+open+files&rnum=20#512bba0739924917> -- http://mail.python.org/mailman/listinfo/python-list