Temporary files not properly cleaned up on Windows

Bug #1086860 reported by Milan Boers
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenTeacher
Status tracked in 3.x
3.x
Fix Released
Medium
Marten de Vries

Bug Description

Exiting OpenTeacher on Windows when having used certain parts of OpenTeacher raises a WindowsError because files that are in use are being tried to be removed. Windows does not allow file deletion for files that are in use, so apparently the files are in still in use for some reason. I have seen this for loaders\t2k\t2k.py:77 and lessons\topo\topo.py:272.

This bug can cause the temp folder to be very large due to many undeleted OpenTeacher maps.

Changed in openteacher:
milestone: none → 3.1
Revision history for this message
Marten de Vries (marten-de-vries) wrote :

This bug happened due to file descriptors returned by tempfile.mkstemp weren't closed. That only gives problems on Windows. The fix was to replace:
path = tempfile.mkstemp()[1]

with

fd, path = tempfile.mkstemp()
os.close(fd)

everywhere. Fixed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.