我无法更新git子模块,错误如下:
$ git submodule init
Submodule 'build/html' (git@github.com:quadroid/clonejs.git) registered for path 'build/html'
...
$ git submodule update
Cloning into 'build/html'...
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Run Code Online (Sandbox Code Playgroud)
但是当我在本地执行相同的任务时,一切都很好.
我如何解决这个问题,以便Travis CI构建通过,我仍然可以单击repo中的子模块来指向它?
我在 Python 中有一个二进制图像,我想将它保存在我的电脑中。一旦存储在我的计算机中,我需要它是一个 1 位深的 png 图像。我怎样才能做到这一点?我尝试了 PIL 和 cv2,但我无法以 1 位深度保存它。
我想测试我的 Django 表单,但出现此错误
django.core.exceptions.ValidationError: ['ManagementForm data is missing or has been tampered with']
Run Code Online (Sandbox Code Playgroud)
这样做:
self.client.post(self.url, {"title" : 'title', "status" : 2, "user" :1})
Run Code Online (Sandbox Code Playgroud)
而我的模型只需要这些字段......
谢谢 :)
编辑1:这是表格:
class ArticleAdminDisplayable(DisplayableAdmin):
fieldsets = deepcopy(ArticleAdmin.fieldsets)
list_display = ('title', 'department', 'publish_date', 'status', )
exclude = ('related_posts',)
filter_horizontal = ['categories',]
inlines = [ArticleImageInline,
ArticlePersonAutocompleteInlineAdmin,
ArticleRelatedTitleAdmin,
DynamicContentArticleInline,
ArticlePlaylistInline]
list_filter = [ 'status', 'keywords', 'department', ]
class ArticleAdmin(admin.ModelAdmin):
model = Article
Run Code Online (Sandbox Code Playgroud)
关于文章模型有太多的继承,所以你必须相信我唯一需要的字段(模型)是标题、状态和用户。
我在python中有以下字典,我将其保存到文件中:
d2 = {
"CHARACTER": {
"IDENTITY": {
"FORM": {
"id": "BK1",
"type": "MAGE",
"role": "DARK"
}
},
"USER": {
"owner": {
"id": "SABBATH13"
},
"level": "16"
}
}
}
jsonfile = open('d2.json', 'w')
jsonfile.write(simplejson.dumps(d2, indent=4))
jsonfile.close()
Run Code Online (Sandbox Code Playgroud)
但是,我被告知这是一个JSON对象,我需要将其转换为表单的JSON数组:
[{
"CHARACTER": {
"IDENTITY": {
"FORM": {
"id": "BK1",
"type": "MAGE",
"role": "DARK"
}
},
"USER": {
"owner": {
"id": "SABBATH13"
},
"level": "16"
}
}
}]
Run Code Online (Sandbox Code Playgroud)
这主要是在开头和结尾添加方括号.
这样做的正确方法是什么?我应该转换为字符串并添加括号,然后转换回来?对不起,这里有JSON新手.
我试图找到这个错误的原因.守则是
def x():
if b == 1:
a = a + 4
print(a)
a = 5
b = 1
x()
Run Code Online (Sandbox Code Playgroud)
第二次使用我的变量a:a = a + 4发生错误.
我正在开发一个主要使用这种类型的作业的程序.