Issue1872
Created on 2012-04-04.12:26:24 by mansion, last changed 2015-01-26.04:16:01 by zyasoft.
msg7025 (view) |
Author: Olivier Mansion (mansion) |
Date: 2012-04-04.12:26:23 |
|
Hi,
A shutil.Error occurs when using shutil.copytree on Windows 7 x64.
Here is a sample:
c:\Users\olivier>c:\sp\lib\python\jython-2.5.3b1-1.6\jython.bat
Jython 2.5.3b1 (2.5:5fa0a5810b25, Feb 22 2012, 12:39:02)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_31
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, shutil
>>> os.mkdir("foo")
>>> open("foo/bar.txt", "w").close()
>>> shutil.copytree("foo", "foo2")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\sp\lib\python\jython-2.5.3b1-1.6\Lib\shutil.py", line 144, in copytree
raise Error, errors
shutil.Error: ['foo', 'foo2', "[Errno 5] Input/output error: 'foo2'"]
Thanks1
|
msg7026 (view) |
Author: Alan Kennedy (amak) |
Date: 2012-04-05.20:59:27 |
|
I get the same error on Windows 2003.
But the copy is actually successful, in that
foo2/
foo2/bar.txt
Both exist after the failure.
Is that true for you as well?
|
msg7027 (view) |
Author: Olivier Mansion (mansion) |
Date: 2012-04-06.08:12:47 |
|
yes, same here.
|
msg7029 (view) |
Author: Alan Kennedy (amak) |
Date: 2012-04-06.18:44:13 |
|
The shutil module that jython uses is copied from cpython, i.e. we don't have a specialised version of it for jython.
Interestingly, the following section appears in the copytree function
####
try:
copystat(src, dst)
except OSError, why:
if WindowsError is not None and isinstance(why, WindowsError):
# Copying file access times may fail on Windows
pass
else:
errors.extend((src, dst, str(why)))
###
And if I comment out those lines, the error no longer appears, i.e. the copytree works correctly, and no errors are reported.
So, now to decide what is the best fix for this.
|
msg7033 (view) |
Author: Alan Kennedy (amak) |
Date: 2012-04-06.20:39:46 |
|
I've confirmed that it is the attempt to update the atime and mtime that is the cause of the error. If I define the copystat function this way
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)
The error does not appear.
|
msg7062 (view) |
Author: Alan Kennedy (amak) |
Date: 2012-04-16.22:15:52 |
|
The version of JNR that we use has been updated on the default branch, i.e. the 2.7 branch.
http://hg.python.org/jython/rev/a6ff07bed361
I can no longer reproduce the error.
Please can the submitter try this against the head revision?
|
msg8257 (view) |
Author: Geoff Bache (geoffbache) |
Date: 2014-03-20.15:13:53 |
|
Just ran into this using virtualenv, which therefore isn't possible to use with Jython 2.5.3 on Windows.
|
msg8706 (view) |
Author: Jim Baker (zyasoft) |
Date: 2014-06-19.05:00:16 |
|
Based on the discussion, apparently this is only an issue on 2.5 on Windows; it will require an update of JNR to support for 2.5.
|
|
Date |
User |
Action |
Args |
2015-01-26 04:16:01 | zyasoft | set | status: open -> closed resolution: out of date |
2014-06-19 05:00:16 | zyasoft | set | nosy:
+ zyasoft messages:
+ msg8706 |
2014-03-20 15:13:53 | geoffbache | set | messages:
+ msg8257 |
2014-03-20 15:06:54 | geoffbache | set | nosy:
+ geoffbache |
2013-02-19 21:32:53 | fwierzbicki | set | nosy:
+ fwierzbicki |
2013-02-19 21:32:44 | fwierzbicki | set | priority: normal versions:
+ Jython 2.5, Jython 2.7, - 2.5.3b1 |
2012-04-16 22:15:52 | amak | set | messages:
+ msg7062 |
2012-04-06 20:39:46 | amak | set | messages:
+ msg7033 |
2012-04-06 18:44:14 | amak | set | messages:
+ msg7029 |
2012-04-06 08:12:48 | mansion | set | messages:
+ msg7027 |
2012-04-05 20:59:28 | amak | set | nosy:
+ amak messages:
+ msg7026 |
2012-04-04 12:26:24 | mansion | create | |
|