How to resolve Json decode error in Ubuntu

  json, python-3.x, ubuntu, windows

I am running python script on Window 10.
In the python script, I am using json library.
When I run the same script on Ubuntu 20.04(running on VMware), I do see json decode error happening.
This behaviour I dont see when I run in Windows 10.

The following is the error I do get when I run the script in Ubuntu

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "uiControl.py", line 83, in getTcpData
    self.taskObj = json.loads(data.decode('utf-8'))
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 5 column 2 (char 73)

Source: Windows Questions

LEAVE A COMMENT