shutil.copy() ist ein Berechtigungsfehler erhöhen:Warum würde shutil.copy() eine Erlaubnis Ausnahme auslösen, wenn CP nicht?
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'
copy-test.py:
import shutil
shutil.copy('src/images/ajax-loader-000000-e3e3e3.gif', 'bin/styles/blacktie/images')
I copy-test.py von der Kommandozeile leite:
python copy-test.py
Aber ausgeführt cp
von der Befehlszeile für die gleiche Datei an das gleiche Ziel führt nicht zu einem Fehler. Warum?
Könnten Sie bitte die Art und Weise Sie das Skript starten schreiben und vielleicht Quellcode von copy-test.py? –