shutil.copy()引发了权限错误:
Traceback (most recent call last):
File "copy-test.py", line 3, in <module>
shutil.copy('src/images/ajax-loader-000000-e3e3e3.gif', 'bin/styles/blacktie/images')
File "/usr/lib/python2.7/shutil.py", line 118, in copy
copymode(src, dst)
File "/usr/lib/python2.7/shutil.py", line 91, in copymode
os.chmod(dst, mode)
OSError: [Errno 1] Operation not permitted: 'bin/styles/blacktie/images/ajax-loader-000000-e3e3e3.gif'
Run Code Online (Sandbox Code Playgroud)
copy-test.py:
import shutil
shutil.copy('src/images/ajax-loader-000000-e3e3e3.gif', 'bin/styles/blacktie/images')
Run Code Online (Sandbox Code Playgroud)
我从命令行运行copy-test.py:
python copy-test.py
Run Code Online (Sandbox Code Playgroud)
但是cp从同一文件的命令行运行到同一目标不会导致错误.为什么?