[Zope-Coders] Win32 Tests - Zope HEAD - Not OK :-(

Guido van Rossum guido@python.org
Tue, 29 Oct 2002 07:57:37 -0500


> >>>Exception exceptions.OSError: (13, 'Permission denied',
> >>
> >>'C:\\WINNT\\TEMP\\~1440-109.inv') in <bound method
> >>TemporaryFileWrapper.__del__ of <closed file
> >>'C:\WINNT\TEMP\~1440-109.inv', mode 'w+b' at 0x028E63B8>> ignored

[Chris Withers]
> >>Anyone know what this means

[Tim Peters]
> > It invariably means someone is trying to delete (unlink) a
> > temporary file that's still open.  That's easy to fall into
> > because Linux doesn't care; Windows forbids it.

[Chris W]
> How do we go about finding out where that's happening?

That's the hard part. ;-)

The message actually says that the file is closed!  This must mean
that *another process* has the file still open.  Could you look inside
the file for clues?

Does this happen every time (or at least can you provoke it easily)?
Then bisection on the set of tests run may help.

> >  and why it's started happening?
> > 
> > Nope.  The most likely cause when this pops up in tests that
> > recently passed is that someone is trying to delete a temp file
> > they noticed was left behind -- that always works on Linux, but on
> > Windows the file absolutely must get closed first.  The Zope tests
> > did leave some temp files behind before, but I don't know
> > specifically which tests were responsible.
> 
> This seems to have started when I moved to using Python 2.2 for the tests...

Hm.  You may have had the same problem in 2.1 but never known it.  In
2.1:

    def __del__(self):
        try: self.close()
        except: pass

In 2.2:

    def __del__(self):
        self.close()

Note that the message also indicates that this is happening in
__del__.  The try/except was intended to avoid such warnings when
close() was called multiple times; close() now handles that in a
different way.  So now *other* errors (that were also masked by the
try/except) are showing up.

--Guido van Rossum (home page: http://www.python.org/~guido/)