I have implemented a doPost operation using the webdev. At the end of the code it is used the function system.util.jsonEncode(dic) where a dictionary is given as the argument of the function through a variable. The type of this variable is a dictionary, but once in a while when running a post operation against this web server it throws the following error in the ignition log:
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 92, in doPost AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'jsonEncode'
The line where the error was raised is:
functions.logger.info(system.util.jsonEncode(info))
The function is correctly called and the variable is a dictionary so does not make sense that this error were raised. As I said this does not happen every time this code is executed, just once in a while, but whithout any specific pattern, or at least none that has been noticed. Once the error appear, the only way to prevent the error to be raise is by executing it in tow steps as follows:
infoJsonString = system.util.jsonEncode(info)
functions.logger.info(infoJsonString)
So, this behaviour of ignition does not make any sense for me. Don’t know if there is any bug that can cause it or if I am doing something wrong. So I was wondering how to fix it.
Thanks!
Mario