SublimeLinter-json icon indicating copy to clipboard operation
SublimeLinter-json copied to clipboard

"strict" mode does not work with builtin python

Open dvcrn opened this issue 6 years ago • 2 comments

The python that comes with ST3 is 3.3 which doesn't have detailed error reporting for json parse errors yet:

>>> import sys
>>> sys.version
'3.3.6 (default, Mar 30 2018, 11:14:15) \n[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]'
>>> import json
>>> json.loads("foo")
Traceback (most recent call last):
  File "./python3.3/json/decoder.py", line 367, in raw_decode
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "./python3.3/json/__init__.py", line 316, in loads
  File "./python3.3/json/decoder.py", line 351, in decode
  File "./python3.3/json/decoder.py", line 369, in raw_decode
ValueError: No JSON object could be decoded

For this linter to work it needs a higher python version or use simplejson

dvcrn avatar Aug 28 '19 06:08 dvcrn

Thanks for reporting. Currently, the design of this plugin doesn't allow us to spin this off to an external python. I also don't want to introduce a dependency like simplejson. So, currently this is a "won't fix", but it's good to keep this open to see if the situation changes in a way that would allow us to improve here. Or if future versions of ST resolve the issue by shipping a newer version of python. I know they are actively working on finding a way to do exactly that, so who knows.

braver avatar Aug 28 '19 09:08 braver

In my fork I added simplejson as dependency to get the linter working here. It works fine but I understand not wanting to introduce it.

I'll run with my own fork for the time being then until this is resolved!

dvcrn avatar Aug 28 '19 10:08 dvcrn