我正在尝试运行以下脚本:https://github.com/Lab41/hermes/blob/master/src/utils/code_etl/repo_to_json.py
在matplotlib的本地副本上。但是我一直收到我不理解的错误消息。我尝试在管理员模式下的命令提示符下运行它,但仍然收到错误消息。
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'
答案 0 :(得分:0)
清理临时存储库失败可能是由于代码的其他部分仍打开了有问题的Git对象文件(在Windows上,这可以防止删除)。但是重要的一点是,该代码是为Python 2编写的,与您使用的3不兼容。 (其他部分使用isNaN
语句,甚至不会编译。)