PC Review


Reply
Thread Tools Rate Thread

Cannot Delete a File?

 
 
W. eWatson
Guest
Posts: n/a
 
      5th Dec 2009
I wrote a Python program that creates a folder with a file in it.
Unfortunately, I did not close the file. Further, the file was empty.
When I tried to delete via XP menu for the file, XP objected on the
grounds the file was being used somewhere else.

I suspect that some process was using within Python to execute the
program was alive and still had a grip on the file.

I did manage to delete the derelict file once. It was after I had
rebooted.

How does ibe generally get out of this? I've had this sort of thing
happen before when I was trying to rename a file, and XP objected for
the reason above. If I continued with other matters, I've found I could
return and delete it.
 
Reply With Quote
 
 
 
 
Bruce Hagen
Guest
Posts: n/a
 
      5th Dec 2009


"W. eWatson" <(E-Mail Removed)> wrote in message
news:hfefe2$juu$(E-Mail Removed)...
> I wrote a Python program that creates a folder with a file in it.
> Unfortunately, I did not close the file. Further, the file was empty. When
> I tried to delete via XP menu for the file, XP objected on the grounds the
> file was being used somewhere else.
>
> I suspect that some process was using within Python to execute the program
> was alive and still had a grip on the file.
>
> I did manage to delete the derelict file once. It was after I had
> rebooted.
>
> How does ibe generally get out of this? I've had this sort of thing happen
> before when I was trying to rename a file, and XP objected for the reason
> above. If I continued with other matters, I've found I could return and
> delete it.



I use this when needed.

Unlocker:
http://ccollomb.free.fr/unlocker/
--

Bruce Hagen
MS-MVP Outlook Express
Imperial Beach, CA


 
Reply With Quote
 
Don Phillipson
Guest
Posts: n/a
 
      5th Dec 2009
"W. eWatson" <(E-Mail Removed)> wrote in message
news:hfefe2$juu$(E-Mail Removed)...

> I wrote a Python program that creates a folder with a file in it.
> Unfortunately, I did not close the file. Further, the file was empty.
> When I tried to delete via XP menu for the file, XP objected on the
> grounds the file was being used somewhere else.
>
> I suspect that some process was using within Python to execute the
> program was alive and still had a grip on the file.
>
> I did manage to delete the derelict file once. It was after I had
> rebooted.
>
> How does ibe generally get out of this? I've had this sort of thing
> happen before when I was trying to rename a file, and XP objected for
> the reason above. If I continued with other matters, I've found I could
> return and delete it.


Windows has had (since Win95) "protections" to prevent
your deleting any file currently loaded. DOS and CMD.EXE
are not limited by these protections, thus can delete any
named file.

--
Don Phillipson
Carlsbad Springs
(Ottawa, Canada)


 
Reply With Quote
 
SPAMCOP User
Guest
Posts: n/a
 
      5th Dec 2009
All the program Bruce mentioned tries to close the file handles, but will
often fail because it cannot drop some dependancies

With your Python program you need to close the file & destroy the new object
to free up memory because keep running it will casuse the machine to tun out
of memory & make the machine unstable

--
SPAMCOP User




"Bruce Hagen" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
>
> "W. eWatson" <(E-Mail Removed)> wrote in message
> news:hfefe2$juu$(E-Mail Removed)...
>> I wrote a Python program that creates a folder with a file in it.
>> Unfortunately, I did not close the file. Further, the file was empty.
>> When I tried to delete via XP menu for the file, XP objected on the
>> grounds the file was being used somewhere else.
>>
>> I suspect that some process was using within Python to execute the
>> program was alive and still had a grip on the file.
>>
>> I did manage to delete the derelict file once. It was after I had
>> rebooted.
>>
>> How does ibe generally get out of this? I've had this sort of thing
>> happen before when I was trying to rename a file, and XP objected for the
>> reason above. If I continued with other matters, I've found I could
>> return and delete it.

>
>
> I use this when needed.
>
> Unlocker:
> http://ccollomb.free.fr/unlocker/
> --
>
> Bruce Hagen
> MS-MVP Outlook Express
> Imperial Beach, CA
>
>


 
Reply With Quote
 
W. eWatson
Guest
Posts: n/a
 
      6th Dec 2009
Don Phillipson wrote:
> "W. eWatson" <(E-Mail Removed)> wrote in message
> news:hfefe2$juu$(E-Mail Removed)...
>
>> I wrote a Python program that creates a folder with a file in it.
>> Unfortunately, I did not close the file. Further, the file was empty.
>> When I tried to delete via XP menu for the file, XP objected on the
>> grounds the file was being used somewhere else.
>>
>> I suspect that some process was using within Python to execute the
>> program was alive and still had a grip on the file.
>>
>> I did manage to delete the derelict file once. It was after I had
>> rebooted.
>>
>> How does ibe generally get out of this? I've had this sort of thing
>> happen before when I was trying to rename a file, and XP objected for
>> the reason above. If I continued with other matters, I've found I could
>> return and delete it.

>
> Windows has had (since Win95) "protections" to prevent
> your deleting any file currently loaded. DOS and CMD.EXE
> are not limited by these protections, thus can delete any
> named file.
>

I drilled down to the folder that has the trouble via cmd window. When I
use DIR, I see:
date time <DIR> .
date time <DIR> ..
date time 0 Analysis
1 File(s) 0 bytes
2 Dir(s) 26...Gigs
Analysis is the folder I created. The file I created has no name and is
empty. I didn't bother to copy date and time.
I'm not really handy with cmd line, so I was unsuccessful copying to
here. I tried del *, but the dir results above went unchanged.
 
Reply With Quote
 
W. eWatson
Guest
Posts: n/a
 
      6th Dec 2009
SPAMCOP User wrote:
> All the program Bruce mentioned tries to close the file handles, but
> will often fail because it cannot drop some dependancies
>
> With your Python program you need to close the file & destroy the new
> object to free up memory because keep running it will casuse the machine
> to tun out of memory & make the machine unstable
>

See my post moments ago. I tried cmd window and could not delete the
nameless file. I backed up to the folder level, .../Analysis and tried
to delete the folder. It gave me the folder is not empty.

Probably if I reboot, the file&folder will be released, and I can delete
them as I mentioned. I can then re-run the Python program with a real
file to write.
 
Reply With Quote
 
W. eWatson
Guest
Posts: n/a
 
      6th Dec 2009
I corrected the Python program and it writes and closes the file
successfully. Getting rid of the erroneous folder and file should be
easy once I reboot.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can i delete an email and skip the delete file as a single step Hugh Microsoft Outlook Discussion 1 8th Apr 2010 01:07 PM
Delete only unread messages in my delete file =?Utf-8?B?U3Vl?= Microsoft Outlook Discussion 3 7th Jul 2005 11:21 AM
Difference between Delete Subfolders and File and Delete =?Utf-8?B?Um9i?= Microsoft Windows 2000 File System 0 29th Jun 2005 03:31 PM
Re: Macro to delete sheets and saves remaining file does not properly delete module gazornenplat Microsoft Excel Programming 0 22nd Jun 2005 01:12 AM
Macro to delete sheets and saves remaining file does not properly delete module pherrero Microsoft Excel Programming 7 21st Jun 2005 05:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:28 AM.