[Buildbot-devel] WindowsError in transfer.py

ECKSCHLAGER Manfred meckschlager at EUROFUNK.COM
Mon Jan 23 09:17:34 UTC 2012


Hi all, 

I'm by far no expert in python, but could it be that transfer.py
(buildbot 0.8.5, line 220) misses a file close. 

Reason for my suspicion is that I sometimes get an exection
(WindowsError) on the line: os.remove(self.tarname) which states that
another process still uses that file and that it therefore can't be
deleted. 

At first I thought the virus scanner would be the culprit but the
problem persisted after disabling it.

Searching the web I found that mkstemp returns a tuple with filename and
an _open_ handle, and this particular handle doesn't get closed in the
finished() step. 

To cut a long story short, is following solution correct? 
def start(self): 
... 
self.fd, self.tarname = tempfile.mkstemp() 
... 
def finished(self, res): 
    os.close(self.fd)    # new 
    self.fp.close() 
    os.remove(self.tarname) 

cheers, 
  manfred



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20120123/e44e8c5e/attachment.html>


More information about the devel mailing list