Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.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 Github更新文件引发UnknownObjectException(404)_Python_Github Api_Pygithub - Fatal编程技术网

Python Github更新文件引发UnknownObjectException(404)

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

我试图用以下代码更新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, branch='main')
它使用最后一行返回一个隐藏的错误堆栈:
github.GithubException.UnknownObjectException:404{“消息”:“未找到”,“文档url”:https://docs.github.com/rest/reference/repos#create-或更新文件内容“}

get方法似乎很有效,因为它允许我打印出文件的原始内容。任何指针,为什么update_file方法不起作用

蒂亚