[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-12-08 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I sometimes have problems deleting files in Windows Explorer.  Sometimes I have 
to wait for reboot, sometimes I have to login as admin.  None of this is a bug 
in Python.  The original post, nearly 9 years ago, was not obviously a Python 
bug report but appears to be question about quirks in Windows.  Two Python 
experts disagreed whether there is a Python bug.

In any case, an open issue needs a repeatable test case that demonstrates a 
problem with current Python running on a currently supported OS, preferably 
without 'poorly designed' 3rd party software involved.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-12-08 Thread Josh Rosenberg

Josh Rosenberg added the comment:

I think you're overinterpreting. The bug probably still exists on Windows if 
you're using a poorly designed anti-virus or indexing tool; nothing fundamental 
has changed in how files are deleted on Windows since this was opened.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-12-07 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
resolution:  -> out of date
stage: test needed -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-08-30 Thread Brian Curtin

Changes by Brian Curtin :


--
nosy:  -brian.curtin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-08-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Unless someone claims and can show that there is a bug in current cpython on 
current Windows (not xp), I think this should be closed.  Josh, I interpret 
your post(s) as suggesting that there is not, or am I over-interpreting.

--
nosy: +terry.reedy
versions: +Python 3.4, Python 3.5 -Python 3.1, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-07-03 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Please pretend I didn't leave off the actual os.remove call at the end of my 
second example that bypasses the issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-07-03 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Similar reference regarding the same basic behavior: 
http://blogs.msdn.com/b/oldnewthing/archive/2012/09/07/10347136.aspx

Short version: Indexing and anti-virus tools prevent deletion from occurring.

Longer version: 
DeleteFile (and all the stuff that ultimately devolves to DeleteFile) operate 
in a funny way on Windows. Internally, it opens a HANDLE to the file, marks it 
as pending deletion, and closes the HANDLE. If no one snuck in and grabbed 
another HANDLE to the file during that time, then the file is deleted when 
DeleteFile's hidden HANDLE is closed. Well designed anti-virus/indexing tools 
use oplocks ( 
http://blogs.msdn.com/b/oldnewthing/archive/2013/04/15/10410965.aspx ) so they 
can open a file, but seamlessly get out of the way if a normal process needs to 
take exclusive control of a file or delete it. Sadly "well-designed" is not a 
term usually associated with anti-virus tools, so errors like this are 
relatively commonplace.

Workarounds like using GetTempFileName() and MoveFile() to move the file out of 
the way will work, though I believe they introduce their own race conditions 
(the temp file itself is created but the HANDLE is closed immediately, which 
could mean a race to open the empty file by the bad anti-virus that would block 
MoveFile()).

Basically, if you're running on Windows, and you're using unfriendly 
anti-virus/indexing tools, there is no clean workaround that maintains the same 
behavior. You can't keep creating and deleting a file of the same name over and 
over without risking access denied errors.

That said, you could probably get the same results by opening and closing the 
file only once. Change from the original pseudocode:

while 1:
with open(myfilename, ...) as myfile:
myfile.write(...)
do_stuff_with(myfilename)
os.remove(myfilename)

to (assuming the default file sharing permissions are amenable):

with open(myfilename, ...) as myfile:
while 1:
myfile.write(...)
myfile.flush()
myfile.seek(0)
do_stuff_with(myfilename)
myfile.truncate()

Same basic pattern, except this time, you're rebuilding the same file over and 
over without ever leaving it unowned long enough for anti-virus/indexing to 
swoop in and steal it from you.

--
nosy: +josh.rosenberg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-07-02 Thread Joram Agten

Joram Agten added the comment:

I think this c win32 issue describes a similar problem
http://stackoverflow.com/questions/3764072/c-win32-how-to-wait-for-a-pending-delete-to-complete

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-02-03 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2011-04-04 Thread Christoph Gohlke

Changes by Christoph Gohlke :


--
nosy: +cgohlke

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2010-08-26 Thread Mark Lawrence

Mark Lawrence  added the comment:

@Brian, Tim, any views on this?

--
nosy: +BreamoreBoy, brian.curtin, tim.golden
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6, Python 3.0

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2009-06-10 Thread Robert Cronk

Robert Cronk  added the comment:

Could this problem be associated with issue4749?  It was found that 
something goes wrong when two cmd children processes are spawned from 
different threads, when the first exits, it is closing file handles 
shared with the first (or something like that) and it's causing a 
problem with logging in issue4749.  That bug has been closed since it's 
not a problem with logging so I'm searching for other similar bugs to 
see if we can create a new bug that documents the cause and link to 
these other bugs that are all showing different symptoms of the bug.  
Thoughts?

--
nosy: +rcronk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2009-03-25 Thread Joram Agten

Joram Agten  added the comment:

touch.exe can be found here:
http://www.helge.mynetcologne.de/touch/index.htm#download

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2009-03-25 Thread Joram Agten

Joram Agten  added the comment:

os.remove2_py30.py gives no error
 should be
os.remove3_py30.py gives no error

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2009-03-25 Thread Joram Agten

Joram Agten  added the comment:

Tested with Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500
32 bit (Intel)] on win32 (windows xp sp2) (pywin 213)

os.remove2_py30.py gives no error

os.remove_winpy30.py gives no error

--
Added file: http://bugs.python.org/file13417/os.remove_win_py30.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2009-03-25 Thread Joram Agten

Joram Agten  added the comment:

Tested with Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500
32 bit (Intel)] on win32 (windows xp sp2)

os.remove.py still gives the same error

Exception in thread Thread-4:
Traceback (most recent call last):
  File "c:\Python30\lib\threading.py", line 507, in _bootstrap_inner
self.run()
  File "os.remove.py", line 25, in run
os.remove(filename)
WindowsError: [Error 32] The process cannot access the file because it
is being used by another process:
'c:\\docume~1\\agtenjo\\locals~1\\temp\\tmpcwbddg'

os.remove2.py still gives the same error

c:\docume~1\agtenjo\locals~1\temp\tmpa3plim
The process cannot access the file because it is being used by another
process.

--
nosy: +cheops
Added file: http://bugs.python.org/file13416/os.remove3_py30.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1425127] os.remove OSError: [Errno 13] Permission denied

2009-03-20 Thread Daniel Diniz

Daniel Diniz  added the comment:

Needs confirmation with recent versions, has nice tests.

--
components: +Windows -None
nosy: +ajaksu2
stage:  -> test needed
type:  -> behavior
versions: +Python 2.6, Python 3.0

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com