PlatformIO Community

PIO Home Inspect (Check Code) of Marlin Firmware fails with "Errors: Bad JSON"

I am building a copy the bugfix-2.0.x branch of Marlin Firmware (https://github.com/MarlinFirmware/Marlin) using environment STM32F103RC_btt_512K.

If I try to Inspect using Check Code, it gets about 70% of the way through before failing with the message “Errors: Bad JSON”,

How do I work out what is causing the problem? Is there a debug mode or log file for Inspect?

Probably the underlying cppcheck fails and doesn’t return any JSON output anymore.

Can you manually pio check -v in the PIO terminal and see where it fails? Might also want to redirect output to a file.

Not helpful…

Tool Manager: Installing platformio/tool-cppcheck @ ~1.210.0
Error: Could not find the package with ‘platformio/tool-cppcheck @ ~1.210.0’ requirements for your system ‘windows_x86’

I am running a 64-bit version of Windows but PIO seems to think it’s 32-bit, presumably because my system installed python is 32-bit. Uninstalling and getting a 64-bit version…

And now, when I try to build, I get…
Fatal Python error: init_sys_streams: can’t initialize sys standard streams

So… Unistall and reinstall Platformio? No change.

Maybe I’ll get back to the original problem sometime…

Hi @starnamer,

This is apparently a python bug, fixed in python 3.7 or 3.8. Details at https://bugs.python.org/issue32849 if you are interested.

Just an FYI.

Cheers,
Norm.

I installed python-3.8.5-amd64.exe. Obviously not fixed in 3.7 or 3.8!

I’ve uninstalled and reinstalled python (twice) and uninstalled and reinstalled Platformio several times.

The error and traceback is:

Fatal Python error: init_sys_streams: can’t initialize sys standard streams
Traceback (most recent call last):
File “C:\Program Files\Python38\lib\io.py”, line 54, in
ImportError: cannot import name ‘open_code’ from ‘io’ (unknown location)

Fixed this by deleting .platformio.

Hmm. I work in IT Support myself, I hate it when something is supposedly fixed, but isn’t.

Does this mean it has installed properly now? And working?

Cheers,
Norm.