如何绕过权限被拒绝错误? [英] How to bypass permission denied error?

查看:71
本文介绍了如何绕过权限被拒绝错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下示例将一个点 shapefile 写入磁盘.但是,当脚本尝试将 shapefile 写入 C:/时出现错误.我可以写入外部硬盘驱动器(G:/).以下是我在 R 中收到的错误:

The following example writes a point shapefile to disc. However, I get an error when the script tries to write a shapefile to C:/. I am able to write to a external hard drive though (G:/). The following is the error I receive in R:

文件错误(out.name, "wb") : 无法打开连接输入另外:警告消息:在文件中(out.name,wb"):无法打开文件'c:/test.shp': 权限被拒绝

Error in file(out.name, "wb") : cannot open the connection In addition: Warning message: In file(out.name, "wb") : cannot open file 'c:/test.shp': Permission denied

如何绕过或解决此错误?

# available from: cran.r-project.org/web/packages/shapefiles/shapefiles.pdf
# Samples of using the convert.to.shapefile function to write out simple shapefiles
# from basic R data.frames

require(shapefiles)
require(maptools)

dd <- data.frame(Id=c(1,2),X=c(3,5),Y=c(9,6))
ddTable <- data.frame(Id=c(1,2),Name=c("Item1","Item2"))
ddShapefile <- convert.to.shapefile(dd, ddTable, "Id", 1)
write.shapefile(ddShapefile, "C:/test", arcgis=T)
shape <- readShapePoints("C:/test")
plot(shape)

推荐答案

简单回答,不要写入系统卷的根级目录.

Simple answer, do not write to the root-level directory of the system volume.

C: 的根目录下创建文件/目录有几个很好的理由,但这不是其中之一.改用 C:/Temp/test.

There are a few good reasons to create files/directories at the root of C:, but this isn't one of them. Use C:/Temp/test instead.

这篇关于如何绕过权限被拒绝错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆