assistant-sdk-python icon indicating copy to clipboard operation
assistant-sdk-python copied to clipboard

googlesamples-assistant-pushtotalk produces a syntax error

Open Vorcas opened this issue 7 years ago • 9 comments

When I try to run pushtotalk it produces a syntax error. I have registered my device correctly: C:\WINDOWS\system32>googlesamples-assistant-devicetool list --model Device Model Id: mygassistant-195601-prototype-v1 Project Id: mygassistant-195601 Device Type: action.devices.types.LIGHT No traits but when running pushtotalk like this: C:\WINDOWS\system32>googlesamples-assistant-pushtotalk --project-id mygassistant-195601 --device-model-id mygassistant-195601-prototype-v1 then the following error is produced: File "c:\program files\python37\lib\site-packages\tenacity_init_.py", line 352 from tenacity.async import AsyncRetrying ^ SyntaxError: invalid syntax Have I got something wrong? I can use the 10 sec audiotest fine, but not pushtotalk. Please help.....

Vorcas avatar Feb 18 '18 03:02 Vorcas

What version of Python are you using, and what version of Tenacity?

python --version pip freeze | grep tenacity

Fleker avatar Feb 20 '18 21:02 Fleker

Are you still seeing this issue?

Fleker avatar Sep 15 '18 22:09 Fleker

@Fleker I am following the Google Assistant Tutorial and am currently at this place: https://developers.google.com/assistant/sdk/guides/service/python/embed/run-sample

Ran into the issue that's described here.

Output:

$ googlesamples-assistant-pushtotalk --project-id my-dev-project --device-model-id my-model
Traceback (most recent call last):
  File "/home/kkufieta/env/bin/googlesamples-assistant-pushtotalk", line 5, in <module>
    from googlesamples.assistant.grpc.pushtotalk import main
  File "/home/kkufieta/env/lib/python3.9/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 29, in <module>
    from tenacity import retry, stop_after_attempt, retry_if_exception
  File "/home/kkufieta/env/lib/python3.9/site-packages/tenacity/__init__.py", line 292
    from tenacity.async import AsyncRetrying
                  ^
SyntaxError: invalid syntax

$ python --version
pip freeze | grep tenacity
Python 3.9.2
tenacity==4.1.0

kkufieta avatar Mar 22 '22 20:03 kkufieta

Hi @Fleker i have the same issue as @kkufieta can you help us please

mohamad-tala avatar Apr 15 '22 11:04 mohamad-tala

same here tenacity 4.1.0 gives syntax error and when update tenacity to 8.0.1 it is giving other errors /home/pi/asistant/env/lib/python3.9/site-packages/cffi/cparser.py:163: UserWarning: Global variable 'stderr' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern') warnings.warn("Global variable '%s' in cdef(): for consistency " /home/pi/asistant/env/lib/python3.9/site-packages/cffi/cparser.py:163: UserWarning: Global variable '__stderrp' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern') warnings.warn("Global variable '%s' in cdef(): for consistency " INFO:root:Connecting to embeddedassistant.googleapis.com Press Enter to send a new request... INFO:root:Recording audio request. WARNING:root:SoundDeviceStream read overflow (3200, 6400) INFO:root:End of audio request detected INFO:root:Transcript of user request: "ses deneme bir ki üç". INFO:root:Playing assistant response. Traceback (most recent call last): File "/home/pi/asistant/env/bin/googlesamples-assistant-pushtotalk", line 8, in <module> sys.exit(main()) File "/home/pi/asistant/env/lib/python3.9/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/home/pi/asistant/env/lib/python3.9/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/pi/asistant/env/lib/python3.9/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/pi/asistant/env/lib/python3.9/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/home/pi/asistant/env/lib/python3.9/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 317, in main continue_conversation = assistant.converse() File "/home/pi/asistant/env/lib/python3.9/site-packages/tenacity/__init__.py", line 324, in wrapped_f return self(f, *args, **kw) File "/home/pi/asistant/env/lib/python3.9/site-packages/tenacity/__init__.py", line 404, in __call__ do = self.iter(retry_state=retry_state) File "/home/pi/asistant/env/lib/python3.9/site-packages/tenacity/__init__.py", line 349, in iter return fut.result() File "/usr/lib/python3.9/concurrent/futures/_base.py", line 433, in result return self.__get_result() File "/usr/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result raise self._exception File "/home/pi/asistant/env/lib/python3.9/site-packages/tenacity/__init__.py", line 407, in __call__ result = fn(*args, **kwargs) File "/home/pi/asistant/env/lib/python3.9/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 123, in converse self.conversation_stream.write(resp.audio_out.audio_data) File "/home/pi/asistant/env/lib/python3.9/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 317, in write buf = normalize_audio_buffer(buf, self.volume_percentage) File "/home/pi/asistant/env/lib/python3.9/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 57, in normalize_audio_buffer buf = arr.tostring() AttributeError: 'array.array' object has no attribute '

drascom avatar Apr 18 '22 21:04 drascom

Has anyone found a way to make this work? I have even tried downgrading Python :-)

mraath avatar Jun 10 '22 14:06 mraath

this worked for me: Please run this command in your virtual environment: pip install -U tenacity But now I get Error: no such option --project-id

mraath avatar Jun 10 '22 14:06 mraath

Has anyone succeeded going past the tenacity version issue? as 8.1.0 is giving us "no such option --project-id".

ExtraKiller avatar Sep 24 '22 13:09 ExtraKiller

Simply run only the googlesamples-assistant-pushtotalk to move forward. My guess is they automatically determine the optional flags from the json when authenticating

AkifManzoor124 avatar Mar 01 '23 02:03 AkifManzoor124