gauravsacc / MMM-GoogleAssistant

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

Syntax Error when running assistant.py script #62

Closed Zpider23 closed 5 years ago

Zpider23 commented 5 years ago

When I run the assistant.py script it gives me this error Traceback (most recent call last): File "/home/pi/MagicMirror/modules/MMM-GoogleAssistant/pi/assistant.py", line 64 pubnub.publish().channel("magicmirror").message("hello from python!!").async(my_publish_callback) ^ SyntaxError: invalid syntax I tried running the script in both locations, but nothing worked. I dont know if this will help but I got syntax errors when trying AssistantMk2 as well

Banhammer1919 commented 5 years ago

I have the same error on raspberry 4 running raspbian buster. Google assistant is running on python3 without problems.

Zpider23 commented 5 years ago

I figured it out. I just had to reflash

Saeijou commented 4 years ago

I figured it out. I just had to reflash

what does that mean exactly?

Dzung2 commented 4 years ago

I have got this error too, I finish run googlesamples-assistant-hotword ... ok and get device_id + paste it to assistant.py too but when I run it with python3 I got the error? I don't think reflash is the idea ?! who can tell me how to fix it? thanks so much! I stuck in it some days @>@

LeftBrainCreated commented 4 years ago

Trying to work through this one myself right now. Maybe we can bring this thread back to life :)

Let me know if you come to a solution, I"ll do the same.

Bit of background.....

Relevant section of code: ` def status(self, pubnub, status): if status.category == PNStatusCategory.PNUnexpectedDisconnectCategory: pass # This event happens when radio / connectivity is lost

    elif status.category == PNStatusCategory.PNConnectedCategory:
        # Connect event. You can do stuff like publish, and know you'll get it.
        # Or just use the connected event to confirm you are subscribed for
        # UI / internal notifications, etc
        pubnub.publish().channel("magicmirror").message("hello from python!!").async(my_publish_callback)
    elif status.category == PNStatusCategory.PNReconnectedCategory:
        pass
   .....

`

LeftBrainCreated commented 4 years ago

Nm, check the linked issue above ^^^^

Or here: https://github.com/gauravsacc/MMM-GoogleAssistant/issues/63

varadwattamwar commented 3 years ago

@LeftBrainCreated @Saeijou @Dzung2 @Zpider23 @Banhammer1919 My sample code works fine. I changed my subscribe key and public key in assistant.py also I entered magic-mirror-device-id and after running assistant.py I receive msgs: pubnub subscription completed and hello from python!! but there is no response from google assistant , google assistant does not work. PLease help me out. Thanks in advance.