[Biopython-dev] Jython on Windows: OSError deleting files

Peter biopython at maubp.freeserve.co.uk
Thu Nov 11 20:19:05 UTC 2010


Hi all,

I recently installed Jython 2.5.1 on Windows XP (32 bit) for
use as a build slave. This showed up some new bugs, in
particular several problems with trying to delete temp
files triggering an OSError.

It turns out this can be triggered by trying to delete a
file while we still have a handle open on it. This is a
Windows limitation, but we don't see it on normal
Python because there the garbage collector closes
handles promptly when they go out of scope. The Java
garbage collector doesn't do that. See also:

http://web.archiveorange.com/archive/v/8tc1Z6ysA03SXedms7TA

In particular, I am aware that if given a filename the
SeqIO and AlignIO read and parse functions did not
explicitly close the handle they open. I was intending
to address this with a with statement in Python 2.5+,
but it can be solved in Python 2.4 as well. I have
started to address this, e.g.
https://github.com/biopython/biopython/commit/0fb039b745b0b2ddacf2a6c9ee8afcdb56018f3c
https://github.com/biopython/biopython/commit/936ea5f348cc1feea8556d263761e77ce960217e

Assuming it will be easier to fix on Python 2.5+, it
might be pragmatic to ignore the issue in the short
term since it only seems to affect Jython on Windows.

Peter



More information about the Biopython-dev mailing list