如何使用 python 在 opcua 上调用具有不同数据类型的多个参数作为输入的方法?

How to call a method with multiple arguments with different datatypes as input on opcua using python?

下面我附上了我的代码和输入参数

ua_types=[('Name', 'LocalizedText'), ('BatchID', 'String'), ('WorkMasterID', 'NodeId'), ('size', 'Double'), 
         ('Description', 'LocalizedText'), ('ClientHandle','UInt64')]
xzy=mthodsetforcreating_controlrecipie.call_method(client.get_node(Creconres),ua.Variant("hil", ua.VariantType.LocalizedText),
    ua.Variant("hill", ua.VariantType.String),ua.Variant("ns=6;s=6/ProjectData/3", ua.VariantType.NodeId),
    ua.Variant(4, ua.VariantType.Double),ua.Variant("", ua.VariantType.LocalizedText),
    ua.Variant(55, ua.VariantType.UInt64))

[![当我调用方法时uaexpert视图][2]][2] [![属性 1][3]][3] [![在此处输入图片描述][4]][4] [![在此处输入图片描述][5]][5]

xzy=mthodsetforcreating_controlrecipie.call_method(client.get_node(Creconres),ua.Variant(ua.LocalizedText("hil"), ua.VariantType.LocalizedText),
    ua.Variant("hill", ua.VariantType.String),ua.Variant("ns=6;s=6/ProjectData/3", ua.VariantType.NodeId),
    ua.Variant(4, ua.VariantType.Double),ua.Variant(ua.LocalizedText(""), ua.VariantType.LocalizedText),
    ua.Variant(55, ua.VariantType.UInt64))

您必须传递 ua.LocalizedText 对象而不是字符串。