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

SourceForge.net noreply at sourceforge.net
Mon Feb 14 12:31:13 CET 2005


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

Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
>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-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