Hello,
Please help. I am using Kemi with the python3 module. I get random TypeError exceptions thrown within the Kamailio code. For example I have the following code:
event = str(KSR.pv.get("$hdr(Event)")) log.logInfo( "KamailioStateful.ksr_request_route_loopback(): " + "Passing the request to the presence " + "publish handler for event: " + event ) rc = KSR.presence.handle_publish() if rc != 1: log.logError( "KamailioStateful.ksr_request_route_loopback(): " + "The presence publish handler returned " + "an error code: " + str(rc) )
This is what I see in the logs:
21(120) ERROR: PY3 {PUBLISH}: app_python3 [python_support.c:167]: python_handle_exception(): apy_exec: ksr_request_route((null)): Unhandled exception in the Python code: TypeError: expected bytes, str found
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/etc/kamailio/kamailio.py", line 91, in ksr_request_route return ksf.ksr_request_route(msg, "Loopback") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/etc/kamailio/kamailio_stateful.py", line 100, in ksr_request_route return self.ksr_request_route_loopback(msg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/etc/kamailio/kamailio_stateful.py", line 240, in ksr_request_route_loopback rc = KSR.presence.handle_publish() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SystemError: <built-in function handle_publish> returned a result with an exception set
If I put the offending line within a Try/Except it hides it but I would rather not see it not happen at all. Any Kemi Python3 users experiencing something similar? What could be causing this?
Regards, Michel Pelletier