[ python-Bugs-1060212 ] os.utime does not work on directories under Windows

SourceForge.net noreply at sourceforge.net
Fri Nov 5 22:10:32 CET 2004


Bugs item #1060212, was opened at 2004-11-04 14:46
Message generated for change (Comment added) made by alexanderweb
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1060212&group_id=5470

Category: Documentation
Group: Python 2.3
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Boyle (boyleboyle)
Assigned to: Tim Peters (tim_one)
Summary: os.utime does not work on directories under Windows

Initial Comment:
On windows 2000, os.utime does not work on a directory,
but gives a permission denied error.

OSError: [Errno 13] Permission denied: '<PATH>'



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

Comment By: Alexander Schremmer (alexanderweb)
Date: 2004-11-05 22:10

Message:
Logged In: YES 
user_id=254738

The docs say about the return codes of _utime:
 EACCES (sic)
 Path specifies directory or read-only file

So it is expected behavior (but not posix compatible, I guess).

Workaround: use cygwin's python.

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

Comment By: Tim Peters (tim_one)
Date: 2004-11-04 22:36

Message:
Logged In: YES 
user_id=31435

I checked in changes to the utime() docs, for Python 2.4, 
being explicit about the case of paths that name directories.  
Changed the Category of this report to Documentation, and 
am closing it now.  If you want utime() to work on directories 
under Windows, you'll have to convince Microsoft to 
implement that in their C library's _utime() function.

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

Comment By: Tim Peters (tim_one)
Date: 2004-11-04 22:05

Message:
Logged In: YES 
user_id=31435

The Python docs say utime() sets times on files.  On 
Windows, directories aren't files; on Unix, directories are 
files.  You'll get the same error on Windows if you pass a 
directory path to Microsoft's _utime() function from C code.

See the MS docs for details, esp. the docs for the EACCES 
error:

http://msdn.microsoft.com/library/en-us/ 
vclib/html/_crt__utime.2c_._wutime.asp

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

Comment By: EDavis (endavis)
Date: 2004-11-04 17:13

Message:
Logged In: YES 
user_id=1131103

Another note to add:

This is only with unicode file names.

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

Comment By: EDavis (endavis)
Date: 2004-11-04 17:07

Message:
Logged In: YES 
user_id=1131103

I also get the Permission Denied on Windows XP for directories.

Windows XP SP2
Python 2.3.4
pywin32 build 202 
NTFS file system

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

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


More information about the Python-bugs-list mailing list