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

Michael Foord fuzzyman at voidspace.org.uk
Thu Jul 20 11:12:43 CEST 2006


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).

The source code snippet is :

if os.path.isdir(targetdir): shutil.rmtree(targetdir) shutil.copytree(thisentry, targetdir)

The code in shutil.py is :

def copystat(src, dst): """Copy all stat info (mode bits, atime and mtime) from src to dst""" st = os.stat(src) mode = stat.S_IMODE(st.st_mode) if hasattr(os, 'utime'): os.utime(dst, (st.st_atime, st.st_mtime)) if hasattr(os, 'chmod'): os.chmod(dst, mode)

Additionally, after running a couple of times I get core dumps when trying to run the interactive interpreter. Oddly IDLE and other programs still run. However this is after installing py2exe, wxPython and pywin32 (all of which have Python 2.5 builds), so there is possibly some weird interaction.

My install directory has the following three dlls in it :

MSVCIRT.dll MSVCP60.dll MSVCRT.dll

It has none of the msvc7 dlls that I would expect.

I'm now at work and so don't have time to experiment, but tonight I will try uninstalling all my Python 2.5 stuff and re-installing just 2.5b2. I will see what dlls are present, run the interpreter a few times, and test a simple script with shutil.copytree.

All the best,

Michael Foord http://www.voidspace.org.uk/python/index.shtml



More information about the Python-Dev mailing list