easy filecopy? - JPython?
Barry A. Warsaw
bwarsaw at cnri.reston.va.us
Tue Jun 15 17:22:18 EDT 1999
>>>>> "Fred" == Fred L Drake <fdrake at cnri.reston.va.us> writes:
Fred> Gordon, This certainly would make sense. The question
Fred> becomes "If os.chmod doesn't exist, should shutil.copy()
Fred> fail?"
I'd say yes, because you can't guarantee the documented semantics,
i.e. that the permission bits are copied. However, shutil.copyfile()
shouldn't fail though -- and doesn't:
JPython 1.1beta1 on java1.2.1
Copyright (C) 1997-1999 Corporation for National Research Initiatives
>>> import shutil
>>> shutil.copy('/tmp/foo.txt', '/tmp/bar.txt')
Traceback (innermost last):
File "<console>", line 1, in ?
File "/home/bwarsaw/projects/python/pristine/Lib/shutil.py", line 53, in copy
File "/home/bwarsaw/projects/python/pristine/Lib/shutil.py", line 34, in copymode
AttributeError: class 'org.python.modules.os' has no attribute 'chmod'
>>> shutil.copyfile('/tmp/foo.txt', '/tmp/bar.txt')
If you had Finn Bock's jnios module (see my other msg in this thread),
then shutil.copymode() and hence shutil.copy() probably won't fail
because then you /would/ have os.chmod(). I haven't tested this
though...
-Barry
More information about the Python-list
mailing list