FreeOpcUa / opcua-asyncio

OPC UA library for python >= 3.7
GNU Lesser General Public License v3.0
1.13k stars 362 forks source link

Exception in subscription loop: KEPServerEX 6.9 opc ua client #457

Closed AndreasHeine closed 3 years ago

AndreasHeine commented 3 years ago

Trace

ERROR:asyncua.server.internal_subscription:Exception in subscription loop Traceback (most recent call last): File "asyncua\server\internal_subscription.py", line 76, in _subscription_loop File "asyncua\server\internal_subscription.py", line 113, in publish_results File "asyncua\server\uaprocessor.py", line 87, in forward_publish_response File "asyncua\server\uaprocessor.py", line 46, in send_response File "asyncua\ua\ua_binary.py", line 248, in struct_to_binary File "asyncua\ua\ua_binary.py", line 271, in to_binary File "asyncua\ua\ua_binary.py", line 248, in struct_to_binary File "asyncua\ua\ua_binary.py", line 271, in to_binary File "asyncua\ua\ua_binary.py", line 243, in struct_to_binary File "asyncua\ua\ua_binary.py", line 283, in list_to_binary File "asyncua\ua\ua_binary.py", line 283, in File "asyncua\ua\ua_binary.py", line 261, in to_binary File "asyncua\ua\ua_binary.py", line 175, in pack_uatype File "asyncua\ua\ua_binary.py", line 446, in extensionobject_to_binary File "asyncua\ua\ua_binary.py", line 243, in struct_to_binary File "asyncua\ua\ua_binary.py", line 283, in list_to_binary File "asyncua\ua\ua_binary.py", line 283, in File "asyncua\ua\ua_binary.py", line 271, in to_binary File "asyncua\ua\ua_binary.py", line 248, in struct_to_binary File "asyncua\ua\ua_binary.py", line 261, in to_binary File "asyncua\ua\ua_binary.py", line 181, in pack_uatype File "asyncua\ua\ua_binary.py", line 248, in struct_to_binary File "asyncua\ua\ua_binary.py", line 261, in to_binary File "asyncua\ua\ua_binary.py", line 179, in pack_uatype File "asyncua\ua\ua_binary.py", line 364, in variant_to_binary File "asyncua\ua\ua_binary.py", line 175, in pack_uatype File "asyncua\ua\ua_binary.py", line 446, in extensionobject_to_binary File "asyncua\ua\ua_binary.py", line 248, in struct_to_binary File "asyncua\ua\ua_binary.py", line 271, in to_binary File "asyncua\ua\ua_binary.py", line 248, in struct_to_binary File "asyncua\ua\ua_binary.py", line 261, in to_binary File "asyncua\ua\ua_binary.py", line 171, in pack_uatype File "asyncua\ua\ua_binary.py", line 35, in pack File "asyncua\ua\uatypes.py", line 40, in datetime_to_win_epoch AttributeError: 'str' object has no attribute 'tzinfo'

Version
Python-Version: 3.7.2 64bit opcua-asyncio Version (e.g. master branch, 0.9): v0.9.12

KEPServerEX: connection localhost (asyncua server) -> KEPServer 2 Tags -> ns=0;i=2267 and ns=0;i=2256 (standard stuff) -> UaExpert (connect to KEPServerEX) -> Sub the tag for remote opcua server (ns=0;i=2256) -> Exception in asyncua server

AndreasHeine commented 3 years ago

found the reason why it happens: https://github.com/FreeOpcUa/opcua-asyncio/blob/f6aa7a972fdc742ff2c983aa1a00437bb359702b/asyncua/server/server.py#L114

https://reference.opcfoundation.org/v104/Core/DataTypes/BuildInfo/

buildDate | UtcTime <-- we propably should make docstrings to hint the types or make some typechecking?

@oroulet if you agree i fix it with a PR?

oroulet commented 3 years ago

Fine for me