Python Github更新文件引发UnknownObjectException(404)
我试图用以下代码更新github上的文件内容Python Github更新文件引发UnknownObjectException(404),python,github-api,pygithub,Python,Github Api,Pygithub,我试图用以下代码更新github上的文件内容 file = repo.get_contents('test.csv', ref="main") data = file.decoded_content.decode("utf-8") data += "\n test;test;test" repo.update_file(file.path, "automatic update", data, file.sha, br
file = repo.get_contents('test.csv', ref="main")
data = file.decoded_content.decode("utf-8")
data += "\n test;test;test"
repo.update_file(file.path, "automatic update", data, file.sha, branch='main')
它使用最后一行返回一个隐藏的错误堆栈:github.GithubException.UnknownObjectException:404{“消息”:“未找到”,“文档url”:https://docs.github.com/rest/reference/repos#create-或更新文件内容“}
get方法似乎很有效,因为它允许我打印出文件的原始内容。任何指针,为什么update_file方法不起作用
蒂亚