我有一个函数,我试图将XML文档复制到我的Dropbox文件夹,但我得到了:
/usr/bin/python3.5 /home/cali/PycharmProjects/Vocabulary/Vocabulary.py
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.5/tkinter/__init__.py", line 1553, in __call__
return self.func(*args)
File "/home/cali/PycharmProjects/Vocabulary/Vocabulary.py", line 232, in add_item
self.sync()
File "/home/cali/PycharmProjects/Vocabulary/Vocabulary.py", line 287, in sync
copyfile(vocabulary_path, destination_path)
File "/usr/lib/python3.5/shutil.py", line 115, in copyfile
with open(dst, 'wb') as fdst:
IsADirectoryError: [Errno 21] Is a directory: '/home/cali/Dropbox/'
Process finished with exit code 0
这是功能:
def sync(self):
path = os.path.expanduser('~/Desktop')
vocabulary_path = os.path.join(path, 'Vocabulary', 'Words.xml')
destination_path = os.path.expanduser('~/Dropbox/')
copyfile(vocabulary_path, destination_path)
我如何克服这个问题?
答案 0 :(得分:4)
可能是将文件复制到另一个文件而不是目录。
PsDSCAllowPlainTextPassword = $true