python - 如何通过python将图像上传到github?
问题描述
我正在尝试将图像从 python 上传到 github,如下所示:
from github import Github
import os
import cv2
token = os.getenv('GITHUB_TOKEN', '...')
g = Github(token)
repo = g.get_repo("path/repo")
content = cv2.imread("/path/to/image.jpeg'")
git_file = 'image.jpeg'
repo.create_file(git_file, "committing files", content, branch="master")
我收到了这个错误:
assert isinstance(content, (str, bytes))
AssertionError
解决方案
推荐阅读
- amazon-route53 - Route 53 上的 DNS CNAME 记录不重定向
- math - 带有其他输入的数学计算的微调器选项
- flutter - BoxDecoration 中的容器颜色几乎是透明的,带有预定义的颜色函数
- django-models - 错误:(models.E015)“排序”指的是不存在的字段、相关字段或查找“名称”
- python - 可以 Plotly 渲染 .gv 文件吗?
- java - 为什么刷新jdbc swing表中的按钮后数据多次出现?
- xamarin.forms - CrossFirebasePushNotification.Current.RegisterForPushNotifications(); 抛出 NullReference iOS
- unity3d - 改变卡位
- python - BeautifulSoup 无法在 Div 之间获取文本
- c# - 如何在没有 azure 的情况下发布和部署多渠道机器人?