Why Can't I Delete a File I Created with Win XP?

W. eWatson wolftracks at invalid.com
Sat Dec 5 23:17:41 EST 2009


J wrote:
> On Sat, Dec 5, 2009 at 21:14, W. eWatson <wolftracks at invalid.com> wrote:
> 
>> What I'm trying to do is really simple. In the Win XP NG, I have two
>> suggestions to get rid of the Analysis folder and the empty file in it. One
>> is to use a program like you suggested, and the other is to delete it from
>> DOS. I just tried cmd prompt, but was not successful. My DOS skills are long
>> gone, so I have no idea if there is something I overlooked there. I bored
>> down to Analysis and the into it. DIR showed an unnamed empty file, so I
>> tried DEL *. I seriously doubt it was removed.
>>
>> Well, I'm going to reboot sometime later this evening, and knock it out as I
>> described I was able to do once before after a reboot. Thne I'm going to fix
>> the Python program and write a file correctly.
> 
> And those are your only options, really.  From what I've been able to
> see, there is no native ability in Linux to actually see who has a
> lock on a file that's been opened.  And I completely understand your
> frustration.
> 
> I've not used the process explorer program, so I really can't say how
> well it works for this kind of thing.  But every post I found
> searching for this indicates that it will at least tell you what still
> has a lock on the file and maybe then you can figure out what needs to
> be closed from there.
> 
> Rebooting should always work in cases like this.  Rebooting the system
> should clear all file locks and is a last resort for a persistent
> stale file lock.  So yeah, by rebooting, you'll always be able to
> release the lock on that file and then delete it once the system is
> back and running.
> 
> However, that's not something you'd want to do on a production system
> except as a last resort.  At least, that's not something that I'd want
> to do.
> 
> So anyway, since you said the code is not yours, does the code
> actually close the files anywhere?  I'm assuming that it does at some
> point, but if not, that really is something that needs to be added in.
>  As I said in my last post, I am just a novice in the Python stuff,
> but I've written enough code in my life to know that you never assume
> that a file will be closed properly by the system once the program is
> finished running.  I'm not saying that YOU specifically are doing
> this, but just making the suggestion as this is the kind of problem
> that can happen.
> 
> Of course, a program that's dying for some reason is a different story... :-)
Well, I'm pretty well done now. I fixed the program so it would write 
the file and close it. It did this successfully. I'll worry about 
getting the oddball file deleted later.



More information about the Python-list mailing list