我已将我们的Sharepoint目录映射到桌面上的本地驱动器。在
如何使用Python将文件从同一台计算机上的另一个本地驱动器复制到该映射驱动器?在
一个简单的代码和所有必要的导入定义将是非常感谢。我对Python很陌生。在
谢谢。在
我试过了
import os
import os.path
import shutil
import sys
import win32wnet
from shutil import copyfile
src = 'C:\mydirectorypath\art.txt'
dst = 'Z:\somefile.txt'
copyfile(src,dst)
这给了我一个错误:
raise SpecialFileError("
%s
is a named pipe" % fn) with open(src, 'rb') as fsrc: with open(dst, 'wb') as fdst: copyfileobj(fsrc, fdst)IOError: [Errno 22] invalid mode ('rb') or filename: 'C:\mydirectorypath\x07rt.txt'
即使不需要将Sharepoint路径映射映射到本地驱动器,也能解决这个问题。在
在sharepoint路径中使用了davwwroot
前面的错误也是由反斜杠()引起的。您需要使用正斜杠(/)
相关问题 更多 >
编程相关推荐