Skip to content

Calling a method with no arguments causes a TypeError #963

@craigh92

Description

@craigh92

Error

press any key to exitERROR:opcua.server.address_space:Error executing method call CallMethodRequest(ObjectId:FourByteNodeId(ns=2;i=26), MethodId:FourByteNodeId(ns=2;i=27), InputArguments:None), an exception was raised: 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/opcua/server/address_space.py", line 466, in _call
    result = node.call(method.ObjectId, *method.InputArguments)
TypeError: wrapper() argument after * must be an iterable, not NoneType

Cause

This is because line 466 expects an iterable:

result = node.call(method.ObjectId, *method.InputArguments)

Fix

This can be fixed by passing in an empty array if there are no input arguments:

if method.InputArguments is None:
    method.InputArguments = []             
result = node.call(method.ObjectId, *method.InputArguments)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions