37,720
社区成员
发帖
与我相关
我的任务
分享
def copyZip():
srcPath = PACKAGE_OUT_PUT_FULL_NAME
toPath = ARG_COPY_ZIP_TO
srcPath = os.path.normcase(srcPath)
toPath = os.path.normcase(toPath)
mdir(srcPath)
mdir(toPath)
toPath = toPath + "/" + ZIP_FILE_NAME
toPath = os.path.normcase(toPath)
print "src file : %s" % srcPath, " copy to : %s" %toPath
# shutil.copyfile(srcPath, toPath) # shutil.copyfile一直报错
toF = file(toPath, "wb") # 这种方式也报错
srcF = open(srcPath, "rb")
toF.write(srcF.read())
toF.close()
srcF.close()
toF = file(toPath, "wb")
IOError: [Errno 13] Permission denied: 'f:\\workfiles\\gameconfig\\dbtable2zipcfgv2\\cfg.zip'
srcFile = r"F:\WorkFiles\GameConfig\cfg.zip"
toFile = r"C:\Users\jave.lin\Desktop\testCopyTarget\cfg.zip"
print "src file : %s" % srcFile, " copy to : %s" %toFile
shutil.copyfile(srcFile, toFile)
toPath路径与上面的一样;
这个可以复制成功;
就我在使用自己用变量组合后的方式就不可以了;
不知道为啥