A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-July/067573.html below:

[Python-Dev] os.utime and os.chmod failures (etc) Python 2.5b2

[Python-Dev] os.utime and os.chmod failures (etc) Python 2.5b2Thomas Heller theller at python.net
Thu Jul 20 14:26:44 CEST 2006
Michael Foord schrieb:
> Hello all,
> 
> There may be a reasonable cause for this (i.e. it is likely to be my 
> fault) - but it is consistent across two different machines I have tried 
> it on.
> 
> With Python 2.5b2 (from the msi at Python.org), running on Windows XP 
> Pro SP2,  ``os.utime`` and ``os.chmod`` fail with WindowsError. The same 
> code runs fine on Python 2.3 and Python 2.4.
> 
> [err]     shutil.copytree(thisentry, targetdir)
> [err]   File "C:\Python25\lib\shutil.py", line 130, in copytree
> [err]     copystat(src, dst)
> [err]   File "C:\Python25\lib\shutil.py", line 67, in copystat
> [err]     os.utime(dst, (st.st_atime, st.st_mtime))
> [err] WindowsError: [Error 13] Access is denied: 'lib\\Pmw'
> [err]
> 
> The script uses ``shutil.copytree`` to copy a directory (using relative 
> paths).

IMO this is a bug in Python 2.5, on Windows.
The problem is that the call to 'copystat(src, dst)' was added to
the shutil.copytree function, in svn r38363 probably.  It will fail
always on Windows, since os.utime does not work on directories (as the
docs correctly explain).

I guess that a patch similar to this one should fix it:

Index: shutil.py
===================================================================
--- shutil.py	(Revision 50710)
+++ shutil.py	(Arbeitskopie)
@@ -127,7 +127,12 @@
         # continue with other files
         except Error, err:
             errors.extend(err.args[0])
-    copystat(src, dst)
+    try:
+        copystat(src, dst)
+    except WindowsError:
+        pass
+    except OSError, err:
+        errors.extend(err.args[0])
     if errors:
         raise Error, errors
 
But you should report this to the bug tracker.

Thomas

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4