Read the statement by Michael Teeuw here.
Fitbit
-
@deepthought said in Fitbit:
When starting Magic Mirror, the Fitbit module displays no info and the cmd prompt states ‘TypeError: PythonShell.run is not a function’ and ‘TypeError: PythonShell is not a constructor’.
Does anyone know how to resolve this issue with python-shell? I’ve tried different versions and installing through different directories without any success. I’ve also tried clean installs of Magic Mirror but that doesn’t help either.After some faffing with the config to get the MM to load I am also getting this same error message when MM now loads.
From what I can see it is pulling the auth tokens correctly and is also able to run the getData.ph as running this on its own returns my total lack of steps etc. But the figures are not updating on MM, I’m assuming this is because of the above error messages.
I was able to get past PythonShell.run is not a function by altering line 9 in the node_helper.js to be:
let {PythonShell} = require(‘python-shell’)
However doing this then gave other error messages relating to code in other files, kind of making me think that this was the wrong thing to do. I’m assuming I am missing something obvious.
Does anyone have any suggestions?
-
hi everyone
i found a workaround
- cd MagicMirror
- mkdir Test
- cd Test
- npm install python-shell@0.5.0
- copy python-shell from Test/node_modules folder to MagicMirror/node_modules
- also copy package.json to node_modules folder of MM
-
@deepthought said in Fitbit:
When starting Magic Mirror, the Fitbit module displays no info and the cmd prompt states ‘TypeError: PythonShell.run is not a function’ and ‘TypeError: PythonShell is not a constructor’.
Does anyone know how to resolve this issue with python-shell? I’ve tried different versions and installing through different directories without any success. I’ve also tried clean installs of Magic Mirror but that doesn’t help either.After some faffing with the config to get the MM to load I am also getting this same error message when MM now loads.
From what I can see it is pulling the auth tokens correctly and is also able to run the getData.ph as running this on its own returns my total lack of steps etc. But the figures are not updating on MM, I’m assuming this is because of the above error messages.
I was able to get past PythonShell.run is not a function by altering line 9 in the node_helper.js to be:
let {PythonShell} = require(‘python-shell’)
However doing this then gave other error messages relating to code in other files, kind of making me think that this was the wrong thing to do. I’m assuming I am missing something obvious.
Does anyone have any suggestions?
I’ve been struggling with this as well with no resolution. Pinging to see if anyone can provide some guidance.
Notes:- brand new Raspian installation on pi 3, B+
- manual installation of Magic Mirror meticulously following instructions (note: the auto-install did not work due to issues with missing npm)
- installed MMM-Fitbit per instructions and have successfully executed getData.py and seen my correct fitbit data (i.e. all the registration and tokens have worked)
- trying to “npm install python-shell” from within the MMM-Fitbit directory has errors as previously described by other users
- doing “npm install python-shell” from the MagicMirror directory will succeed but I’ve no idea if this is where it should be done instead. After install, the following has been created: ~/MagicMirror/node_modules/python-shell
I’ve tried re-installing from scratch several times to make sure I’m following instructions closely but no luck. Any guru guidance would be appreciated!
Thanks, Peter.
-
-
Hi is the module still working ?.???.
-
This post helped me the most.
-
Example config file on the module GitHub page contains errors. The character after config: should be {, not [
-
The secret key and appID field values need to be surrounded by single quotes, something not explained in the readme file.
Thank you.
-
-
Hi guys,
I don’t know if the module is still maintained. But I have just implemented it. I have got the credentiels. I have put the code in the config.js file. It works fine but I have no datas refresh and an error in the log :
/home/pi/.pm2/logs/mm-error.log last 15 lines: 0|mm | [2020-05-10 13:41:56.342] [ERROR] TypeError: PythonShell.run is not a function 0|mm | at Class.setCreds (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:32:15) 0|mm | at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:18:9) 0|mm | at Socket. (/home/pi/MagicMirror/js/node_helper.js:113:11) 0|mm | at Socket.emit (events.js:200:13) 0|mm | at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12 0|mm | at processTicksAndRejections (internal/process/task_queues.js:82:9) 0|mm | [2020-05-10 13:41:56.380] [ERROR] TypeError: PythonShell is not a constructor 0|mm | at Class.getData (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:43:25) 0|mm | at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:22:9) 0|mm | at Socket. (/home/pi/MagicMirror/js/node_helper.js:113:11) 0|mm | at Socket.emit (events.js:200:13) 0|mm | at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12 0|mm | at processTicksAndRejections (internal/process/task_queues.js:82:9) . . . 0|mm | [2020-05-10 13:43:43.317] [LOG] 0|mm | Set credential request recieved. 0|mm | [2020-05-10 13:43:43.318] [LOG] 0|mm | { 0|mm | client_id: '22BR8T', 0|mm | client_secret: '51313d185cxxxxxxxxxxxxxxxxd141c99' 0|mm | } 0|mm | [2020-05-10 13:43:43.329] [LOG] 0|mm | Whoops! There was an uncaught exception... 0|mm | [2020-05-10 13:43:43.330] [ERROR] TypeError: PythonShell.run is not a function 0|mm | at Class.setCreds (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:32:15) 0|mm | at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:18:9) 0|mm | at Socket. (/home/pi/MagicMirror/js/node_helper.js:113:11) 0|mm | at Socket.emit (events.js:200:13) 0|mm | at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12 0|mm | at processTicksAndRejections (internal/process/task_queues.js:82:9) 0|mm | [2020-05-10 13:43:43.334] [LOG] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? 0|mm | [2020-05-10 13:43:43.335] [LOG] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues 0|mm | [2020-05-10 13:43:43.336] [LOG] Initial run request recieved. 0|mm | [2020-05-10 13:43:43.338] [LOG] Running getData.py 0|mm | [2020-05-10 13:43:43.339] [LOG] Whoops! There was an uncaught exception... 0|mm | [2020-05-10 13:43:43.342] [LOG] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? 0|mm | [2020-05-10 13:43:43.342] [LOG] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues 0|mm | [2020-05-10 13:43:43.344] [LOG] [NewPIR] Initialize... 0|mm | [2020-05-10 13:43:43.340] [ERROR] TypeError: PythonShell is not a constructor 0|mm | at Class.getData (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:43:25) 0|mm | at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:22:9) 0|mm | at Socket. (/home/pi/MagicMirror/js/node_helper.js:113:11) 0|mm | at Socket.emit (events.js:200:13) 0|mm | at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12 0|mm | at processTicksAndRejections (internal/process/task_queues.js:82:9)
Do someone has any idea of that error ?
-
@Arno-Strasbourg Hey, please install MMM-Fitbit2 that works perfect.:thumbs_up_medium-light_skin_tone:
-
Oh ! There is an other app !! Where can I found it ? It isn’t on the gitub third party modules ?
Edit : Got it ! Thank you @Stoffbeuteluwe
-