-
Documentation task
-
Resolution: Fixed
-
Trivial
-
None
-
None
-
Team A
-
Sprint 90 (Jul 2022), Sprint 91 (Aug 2022)
-
0.25
The code on this page is not compatible with Python 3.
https://www.zabbix.com/documentation/current/en/manual/appendix/protocols/header_datalen
packet = "ZBXD\1" + struct.pack('<Q', len(data)) + data
it fails with error:
TypeError: can only concatenate str (not "bytes") to str
Here is modified code line which works for v3:
packet = "ZBXD\1" + struct.pack('<Q', len(data)).decode() + data
i.e. we need to convert a middle part to string by calling method .decode() to it.
I verified result and it's correct. And it works with Python v2 too.