MMM-Fitbit2 PythonShell is not a constructor
-
I set up MMM-Fitbit2 recently, and have gone through the setup and authorisation. It seemed to go ok, but now it stops at loading. There’s a PythonShell error in the logs, which seems to be affecting a few other modules.
I’ve tried to use the fixes for some of the other modules, but I don’t know enough to get them to work.
I’ve attached the error below. Does anyone know how to fix it please?
[05.04.2021 01:04.45.169] [ERROR] Whoops! There was an uncaught exception... [05.04.2021 01:04.45.169] [ERROR] SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at /home/pi/MagicMirror2/modules/MMM-Remote-Control/node_helper.js:1018:33 at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3) [05.04.2021 01:04.45.169] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? [05.04.2021 01:04.45.169] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues [05.04.2021 01:07.33.662] [ERROR] Whoops! There was an uncaught exception... [05.04.2021 01:07.33.662] [ERROR] TypeError: PythonShell is not a constructor at Class.getData (/home/pi/MagicMirror2/modules/MMM-Fitbit2/node_helper.js:54:25) at Class.socketNotificationReceived (/home/pi/MagicMirror2/modules/MMM-Fitbit2/node_helper.js:17:9) at Socket.<anonymous> (/home/pi/MagicMirror2/js/node_helper.js:112:11) at Socket.emit (events.js:198:13) at process.nextTick (/home/pi/MagicMirror2/node_modules/socket.io/dist/socket.js:435:32) at process._tickCallback (internal/process/next_tick.js:61:11) [05.04.2021 01:07.33.662] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? [05.04.2021 01:07.33.662] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
-
@tippon as I recall the node_helper.js code has to change the require statement to look like this
const {PythonShell} = require( 'python-shell');
just add the braces around the word
PythonShell -
@sdetweil Once again, you are a superstar. It’s working, thank you
I thought I’d tried that the other night, but for some reason it didn’t work. I don’t know if I typed it in wrong, or if I messed it up when I tried to do it remotely through my phone. Either way, it’s working now, and I’m a happy bunny
-
Hi - I have just committed this fix: https://github.com/m-roberts/MMM-Fitbit2/commit/e958665dcf63900d38f5405961a1a176d5ba2fcf