Syntax Error when running assistant.py script
Zpider23 opened this issue · 7 comments
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
I have the same error on raspberry 4 running raspbian buster.
Google assistant is running on python3 without problems.
I figured it out. I just had to reflash
I figured it out. I just had to reflash
what does that mean exactly?
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 @>@
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.....
- MagicMirror (smartMirror) project
- Google Assistant hotword tests work as expected
- Launching assistant.py alone throws the following error:
(env) pi@raspberrypi:~/Documents/NodeProjects/MagicMirror/modules/MMM-GoogleAssistant/pi $ python assistant.py File "assistant.py", line 64 pubnub.publish().channel("magicmirror").message("hello from python!!").async(my_publish_callback) ^ SyntaxError: invalid syntax
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
.....
`
Nm, check the linked issue above ^^^^
Or here: #63
@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.