MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

Syntax error in python-shell



  • Hi,

    I keep getting this error:

    SyntaxError: Unexpected token d in JSON at position 0
    at JSON.parse ()
    at PythonShell.asJson (/home/linaro/node_modules/python-shell/index.js:350:21)
    at /home/linaro/node_modules/python-shell/index.js:300:42
    at Array.forEach ()
    at PythonShell.recieveInternal (/home/linaro/node_modules/python-shell/index.js:298:15)
    at PythonShell.receive (/home/linaro/node_modules/python-shell/index.js:272:21)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:279:12)
    at readableAddChunk (_stream_readable.js:260:13)
    at Socket.Readable.push (_stream_readable.js:219:10)

    I`m not entirely sure what causes it and how to fix it… the mirror seems to be working fine.

    Any help would be apreciated.

    Thanks.



  • usually that error means that somehow an object was passed into the JSON.parse() routine, which expects are string…



  • Yea, I kind of found out what is triggering it, however I`m not sure how to stop it. The flick Large module is sending direction == OUTPUT messages continuously for some reason. Any idea what this is or how to make a filter to stop it?



  • Sorry know nothing about flick



  • https://forum.magicmirror.builders/topic/8907/flick-large-gesture-control

    Here is the code I`ve written and adapted to work as MMM module.



  • Solved. It was actually the GPIO library for the ASUS tinker board, its RPi.GPIO implementation actually. It had a useless printf that sent that annoying message that messed up the json message. I removed that line and rebuilt from source and now it`s working flawlessly. Thanks.



  • @radu_stancu great debugging! and thanks for the detailed feedback… someone else might fall into this same trouble


Log in to reply