[ python-Bugs-1092701 ] os.remove fails on win32 with read-only file

SourceForge.net noreply at sourceforge.net
Sat Nov 12 21:05:52 CET 2005


Bugs item #1092701, was opened at 2004-12-29 15:30
Message generated for change (Settings changed) made by effbot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1092701&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.4
>Status: Closed
>Resolution: Wont Fix
Priority: 3
Submitted By: Joshua Weage (jpweage)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.remove fails on win32 with read-only file

Initial Comment:
On Windows XP SP2 and Python 2.3.3 or 2.4 a call to
os.remove returns Errno 13 permission denied on a
read-only file.  On linux, python will delete a
read-only file.



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

>Comment By: Fredrik Lundh (effbot)
Date: 2005-11-12 21:05

Message:
Logged In: YES 
user_id=38376

No followups in over 6 months. Closing.

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

Comment By: Fredrik Lundh (effbot)
Date: 2005-02-14 12:31

Message:
Logged In: YES 
user_id=38376

This is a platform issue; Windows associates delete privileges 
with the file, Unix with the directory.  I doubt it's a good idea 
to "fix" Python's remove by making it incompatible with the C 
library's implementation.

(on the C level, unlink() is the same thing as remove(), btw).


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

Comment By: Robert Brewer (aminusfu)
Date: 2005-01-01 10:13

Message:
Logged In: YES 
user_id=967320

Yup. I can reproduce that on Win2k.

Seems posixmodule.c uses _unlink, _wunlink, which are
documented at MS as failing on readonly:

"Each of these functions returns 0 if successful. Otherwise,
the function returns –1 and sets errno to EACCES, which
means the path specifies a read-only file, or to ENOENT,
which means the file or path is not found or the path
specified a directory."

Seems others have "fixed" it by just changing the mode and
trying again:
http://sources.redhat.com/ml/cygwin/2001-05/msg01209.html
https://www.cvshome.org/cyclic/cvs/unoff-watcom.txt


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

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


More information about the Python-bugs-list mailing list