[ python-Bugs-1180237 ] Python keeps file references after calling close methode

SourceForge.net noreply at sourceforge.net
Sun Apr 10 17:20:05 CEST 2005


Bugs item #1180237, was opened at 2005-04-10 17:20
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1180237&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Eelco (eternia)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python keeps file references after calling close methode

Initial Comment:
I found this bug using a python script that:

- first mounts a partition  (os.system("mount") etc)
- change a few files on this partition (f = open ();
f.write; f.close)
- umounts the partition (os.system("umount") etc)

Strangely, the umount didn't work because of a
filesystem busy error. Using fuser and lsof i traced
this being busy back to the script itself. This is
strange behavior because after changing the files on
the mounted partition the close method was called which
should close all references to the file on the partition. 

Finally the solution was to do f = 0. So if python has
closed a file on a mount a open reference to that file
will keep to exist until the script has ended or until
the file object is nullified.





----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1180237&group_id=5470


More information about the Python-bugs-list mailing list