首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PermissionError:[WinError 5]访问被拒绝:

PermissionError:[WinError 5]访问被拒绝:
EN

Stack Overflow用户
提问于 2018-10-06 21:54:50
回答 1查看 2.7K关注 0票数 0

我正在尝试运行以下脚本:json.py

在本地的matplotlib副本上。但我一直收到这条我不明白的错误信息。我尝试在管理员模式下在命令提示符下运行它,但仍然得到错误。

代码语言:javascript
复制
 Traceback (most recent call last):
  File "C:/Users/daman/Desktop/hermes-master/src/utils/code_etl    /repo_to_json.py", line 211, in <module>
repo_name
  File "C:/Users/daman/Desktop/hermes-master/src/utils/code_etl/repo_to_json.py", line 130, in process_local_repo
output_file = output_dir + "/" + repo_name.replace('/', '_') + ".json"
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/daman/Desktop/hermes-master/src/utils/code_etl/repo_to_json.py", line 211, in <module>
repo_name
  File "C:\Users\daman\Desktop\hermes-master\src\utils\code_etl\git_manager.py", line 66, in __exit__
shutil.rmtree(self.__tempdir)
  File "C:\Users\daman\AppData\Local\Programs\Python\Python37-32\lib\shutil.py", line 507, in rmtree
return _rmtree_unsafe(path, onerror)
  File "C:\Users\daman\AppData\Local\Programs\Python\Python37-32\lib\shutil.py", line 386, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
  File "C:\Users\daman\AppData\Local\Programs\Python\Python37-32\lib\shutil.py", line 386, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
  File "C:\Users\daman\AppData\Local\Programs\Python\Python37-32\lib\shutil.py", line 386, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
  File "C:\Users\daman\AppData\Local\Programs\Python\Python37-32\lib\shutil.py", line 391, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\daman\AppData\Local\Programs\Python\Python37-32\lib\shutil.py", line 389, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\daman\\AppData\\Local\\Temp\\tmpe6tqnsio\\matplotlib\\.git\\objects\\pack\\pack-e0ef0cedb6b5eee531ff1c53aea599034caa1649.idx'
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-07 01:53:13

清理临时存储库的失败可能是由于代码的其他部分仍在打开Git对象文件(在Windows上,这可以防止删除)。但重要的一点是,这段代码是为Python 2编写的,与您正在使用的3不兼容。(其他部分使用print语句,甚至不编译。)

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52683656

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档