Automater 워크 플로를 복사하려고하는데 설정 파일에이 워크 플로를 나열했습니다. 구성 파일을 반복하고 디렉토리를 복사하려고합니다. 그들은 이름에 공백이 있으며 문제가 있습니다.디렉토리를 복사하는 데 문제가 있습니다.
그것은 올바르게 등 파일 이름을 인쇄하지만 복사는 복사
import os
import shutil
confdir=os.getenv("my_config")
dropbox=os.getenv("dropbox")
conffile = ('services.conf')
conffilename=os.path.join(confdir, conffile)
sourcedir= (r'~/Library/Services/')
destdir=os.path.join(dropbox, "My_backups")
for file_name in open(conffilename):
sourcefile=os.path.join(sourcedir, repr(file_name.strip()))
print sourcefile
destfile=os.path.join(destdir, file_name.strip())
shutil.copytree(sourcefile, destfile)
로 이름 주위에 ""추가로있을 것 같습니다으로 실패하고 오류 사전
에서~/Library/Services/'Add PDF Metadata.workflow'
Traceback (most recent call last):
File "Untitled 3.py", line 15, in <module>
shutil.copytree(sourcefile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 168, in copytree
names = os.listdir(src)
OSError: [Errno 2] No such file or directory: "~/Library/Services/'Add PDF Metadata.workflow'"
감사입니다
나는 아래의 제안을 시도했지만 여전히 작동하지 않습니다.
내가 그것을 해결하기 위해 관리하는 모든 여기 http://stackoverflow.com/questions/13052341/i-seem-to-get-an-error-although-the-script-runs-i-cant- 왜 - 왜 – geekcomputers