Porcupine Issue: syntax error raised when running porcupine_demo_mic
See original GitHub issueMake sure you have read the documentation, and have put forth a reasonable effort to find an existing answer.
Expected behaviour
Unknown, code does not run
Actual behaviour
With environment variable ACCESS_KEY set to access key from picovoice account and with network access available.
$ porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords porcupine
Traceback (most recent call last):
File "/usr/local/bin/porcupine_demo_mic", line 6, in <module>
from pvporcupinedemo.porcupine_demo_mic import main
File "<fstring>", line 1
(self._access_key=)
^
SyntaxError: invalid syntax
With access code encoded in command
$ porcupine_demo_mic --access_key O6m<redacted middle of access code>4fg== --keywords porcupine
Traceback (most recent call last):
File "/usr/local/bin/porcupine_demo_mic", line 6, in <module>
from pvporcupinedemo.porcupine_demo_mic import main
File "<fstring>", line 1
(self._access_key=)
^
SyntaxError: invalid syntax
Steps to reproduce the behaviour
Running on hyproit on RPi 3B+ which comes with python 3.7.3 Installed pvporcupine as per destructions at: https://picovoice.ai/docs/quick-start/porcupine-python/
Tried example python code but could not resolve issues I was finding it would not resolve the env to pick up the access key.
$ python
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pvporcupine
>>> porcupine = pvporcupine.create(
... access_key='${ACCESS_KEY}',
... keywords=['picovoice', 'bumblebee']
... )
[ERROR] failed to parse AccessKey '${ACCESS_KEY}'
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/usr/local/lib/python3.7/dist-packages/pvporcupine/__init__.py", line 82, in create
sensitivities=sensitivities)
File "/usr/local/lib/python3.7/dist-packages/pvporcupine/porcupine.py", line 158, in __init__
raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]()
pvporcupine.porcupine.PorcupineInvalidArgumentError
>>>
I tried embedding the key in the code and the code worked fine with access key embedded in the code, except the python code example was obviously stunted and not a full example.
Opted into using the demo at https://picovoice.ai/docs/quick-start/porcupine-python/#demo and so then arrived at the syntax error reported at the top.
Uninstalled everything then reinstalled but then got:
$ porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords porcupine
-bash: /usr/local/bin/porcupine_demo_mic: No such file or directory
$ porcupine_demo_mic --access_key O6mlLw<redacted middle of key>ujA//WcHJ8w4fg== --keywords porcupine
-bash: /usr/local/bin/porcupine_demo_mic: No such file or directory
$ porcupine_demo_mic --help
-bash: /usr/local/bin/porcupine_demo_mic: No such file or directory
HypriotOS/armv7: pirate@silver-pearl in ~
As I was setting a new RPi with hyproit, I reburned the SD card from scratch and so the first thing I tried was pip3 install pvporcupinedemo
and then
$ /home/pirate/.local/bin/porcupine_demo_mic --access_key O6mlLwkDR<redacted middle of key>BrujA//WcHJ8w4fg== --keywords porcupine
Traceback (most recent call last):
File "/home/pirate/.local/bin/porcupine_demo_mic", line 6, in <module>
from pvporcupinedemo.porcupine_demo_mic import main
File "<fstring>", line 1
(self._access_key=)
^
SyntaxError: invalid syntax
I have tried no quotes, single and double quotes around the key - to same end result. Network has been up the entire time (and would need to be since I am sshing into the RPi and pulling down files using pip3).
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (3 by maintainers)
Top GitHub Comments
So, I burned onto a SD:
Setup wifi and ssh so I could get files from my PC (test.wav for example).
Ran:
Python version that comes with:
As for previous report, the demo versus the wav file worked. So this time did:
So is this the difference between Python 3.7.3 that came with hypriot and the 3.9.2 that comes with RPi OS Lite? I’ll look into it.
@creating-worlds
Hmmm. Can’t help at the moment. https://github.com/Picovoice/porcupine/issues/653 so I’ve a few weeks left before I can try again. But isn’t it odd then that it looked like I had sorted my problem by installing 3.9.2 on hypriot, since it wasn’t apparently a problem on the Raspian OS, but then which Raspian version may be the question. Double hmmn.