gauravsacc / MMM-GoogleAssistant

Google Assistant module for magic mirror https://github.com/MichMich/MagicMirror
MIT License
117 stars 40 forks source link

Async Error - Python 3.7 #82

Open truejp opened 3 years ago

truejp commented 3 years ago

Hey there, I'm facing the following issue with the assistant.py script:

pi@raspberrypi:~/MagicMirror/modules/MMM-GoogleAssistant/pi $ python3 assistant.py File "assistant.py", line 64 pubnub.publish().channel("magicmirror").message("hello from python!!").async(my_publish_callback) ^ SyntaxError: invalid syntax

Looks like there is either dependency missing on my side, but it might also be a change within the syntax of the more recent python versions? I can't find useful information on that online, maybe anyone over here can help me fix this.

Best regards, Philipp

Edit: I'm not that familiar with code quoting on GitHub, the issue points at the 'c' of .async(...). :)

truejp commented 3 years ago

Worked out some changes, still need to further analyze how the script works. At least I'm able compile it by now.

assistant.zip

truejp commented 3 years ago

Looks like the issue could be fixed using ".pn_async(callback_function)" instead of ".async(callback_function)". See "other examples" over here: https://www.pubnub.com/docs/sdks/python/api-reference/publish-and-subscribe

Still need to double check tho, stay tuned.

Edit: Well, the changed script kind of works (plays a sound once I say "Hey Google"), however it crashes afterwards and MM won't start using this module.

truejp commented 3 years ago

Hey guys, my installation of the Google Assistant API had an issue. With the changes mentioned in my last comment, the service works perfectly fine!! Please consider including the changes in your assistant.py script. Best regards, Philipp

varadwattamwar commented 3 years ago

Hey guys, my installation of the Google Assistant API had an issue. With the changes mentioned in my last comment, the service works perfectly fine!! Please consider including the changes in your assistant.py script. Best regards, Philipp

Can you please help me out, in my code demo, google assistant is only responding 1-2 times in every 20 tries. I also changed my mic sensitivity but the results are same. Im using Raspberry pi 3B

burnerbmx commented 3 years ago

pi@raspberrypi:~/MagicMirror/modules/MMM-GoogleAssistant/pi $ /home/pi/env/bin/python3 -u assistant.py File "assistant.py", line 64 pubnub.publish().channel("magicmirror").message("hello from python!!").async(my_publish_callback) ^ SyntaxError: invalid syntax pi@raspberrypi:~/MagicMirror/modules/MMM-GoogleAssistant/pi $ hello im getting ths error ive had the google assit on in my command line and it works a treat