Hello all,
In our Ignition Perspective project, we've encountered a module error related to the JSON library. This issue is frequently triggering errors that are flooding our gateway logs.
The Error is Below:
Traceback (most recent call last): File "<function:runAction>", line 3, in runAction File "/usr/local/bin/ignition/user-lib/pylib/json/__init__.py", line 108, in <module> from .decoder import JSONDecoder File "/usr/local/bin/ignition/user-lib/pylib/json/decoder.py", line 24, in <module> NaN, PosInf, NegInf = _floatconstants() File "/usr/local/bin/ignition/user-lib/pylib/json/decoder.py", line 18, in _floatconstants _BYTES = '7FF80000000000007FF0000000000000'.decode('hex') LookupError: unknown encoding 'hex'
Image of the Error:
If Anyone has encountered this issue before, please share your insights or solutions. Your assistance would be greatly appreciated.
Thanks.
Well... How about you show us the code ?
And not just an image of the code. Format it properly.
PS: Don't ping people.
The code in Import json that is,
What happens if you try to import it from somewhere else ?
If i try to import json in script console it will through the below error,
Traceback (most recent call last): File "function:runAction", line 1, in runAction File "/usr/local/bin/ignition/user-lib/pylib/json/**init** .py", line 108, in from .decoder import JSONDecoder File "/usr/local/bin/ignition/user-lib/pylib/json/decoder.py", line 24, in NaN, PosInf, NegInf = _floatconstants() File "/usr/local/bin/ignition/user-lib/pylib/json/decoder.py", line 18, in _floatconstants _BYTES = '7FF80000000000007FF0000000000000'.decode('hex') LookupError: unknown encoding 'hex'
Don't use json
from jython's stdlib. Use Ignition's system.util.jsonDecode()
and/or system.util.jsonEncode()
functions--these are documented and supported.
Please see Wiki - how to post code on this forum. Use this when posting code or error messages. Thanks.
Okay, @pturmel Thanks for your Reply.