Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 错误13权限被拒绝_Python_Compiler Errors_Python 2.4 - Fatal编程技术网

Python 错误13权限被拒绝

Python 错误13权限被拒绝,python,compiler-errors,python-2.4,Python,Compiler Errors,Python 2.4,我试图编写一个代码来比较目录(子目录和其中的文件),然后将其他目录的内容(文件仅包括子目录中的文件)复制到其他目录。我导入了所有内容,然后我有了这个: dst = "C:/somefolder" path = "C:/otherplace" compare = filecmp.dircmp(path,dst) ans = compare.right_only for fil in ans: if len(ans)>0: shutil.copy2(dst,path) 我尝试

我试图编写一个代码来比较目录(子目录和其中的文件),然后将其他目录的内容(文件仅包括子目录中的文件)复制到其他目录。我导入了所有内容,然后我有了这个:

dst = "C:/somefolder" 
path = "C:/otherplace"
compare = filecmp.dircmp(path,dst)
ans = compare.right_only 
for fil in ans:
  if len(ans)>0:
    shutil.copy2(dst,path)
我尝试过使用os.listdir的其他路由,但我似乎总是以错误告终

IOError:[Errno 13]权限被拒绝

这是用python 24编写的


我正在使用cygwin运行代码,但我是windows用户

您无权在该位置编写代码。若要验证,请转到该路径并尝试创建新文件夹。你能创建一个吗?我可以创建新文件夹,我是管理员。如果你在windows计算机上,请尝试以管理员身份运行脚本<代码>以管理员身份运行我不知道该怎么做。右键单击cmd.exe并点击“以管理员身份运行”