我只有一个选择,在这个选择中,我只想用一个字段传递类的对象。在
这是我的密码片段:-在
from pyasn1.type import univ, namedtype, tag, char, namedval, useful
from pyasn1.codec.ber import encoder
class MiepPullWtdr(univ.Sequence):
componentType = namedtype.NamedTypes(namedtype.NamedType('wtdrId', univ.Integer().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))))
class ChoiceData(univ.Choice):
componentType = namedtype.NamedTypes(namedtype.NamedType('miepPullWtdr', MiepPullWtdr().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))))
seqObj = MiepPullWtdr()
seqObj.setComponentByName('wtdrId', 6555)
choiceObj = ChoiceData()
choiceObj.setComponentByName('miepPullWtdr', seqObj)
当我运行脚本时测试.py,它抛出这个错误:-在
^{pr2}$有什么帮助吗?谢谢。在
在
MiepPullWtdr
类型如何在其独立定义中标记为ASN.1与作为ChoiceData
组件的方式存在不一致。我不知道你的意图是什么,这里有可能是许多一致的版本之一:相关问题 更多 >
编程相关推荐