Issue 1092701: os.remove fails on win32 with read-only file (original) (raw)

Created on 2004-12-29 14:30 by jpweage, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg23842 - (view) Author: Joshua Weage (jpweage) Date: 2004-12-29 14:30
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.
msg23843 - (view) Author: Robert Brewer (aminusfu) Date: 2005-01-01 09:13
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
msg23844 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2005-02-14 11:31
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).
msg23845 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2005-11-12 20:05
Logged In: YES user_id=38376 No followups in over 6 months. Closing.
History
Date User Action Args
2022-04-11 14:56:08 admin set github: 41375
2004-12-29 14:30:49 jpweage create