I tried to test the examples given in github but I don't know how to setup the proto instruction stated in the https://github.com/wiboma/hudiy/tree/main/examples .
"protoc --python_out=python/common ../api/Api.proto " - I tried to get this going but it always throw errors stating cannot find the path and even I give the absolute path.
protoc --python_out=$HOME/.hudiy/share/examples/api/python/common $HOME/.hudiy/share/api/Api.proto
when trying out this KeyStrokes.py example, i get this error. I'm lost. thanks for any help. Not familiar with protobuffer and TCP... I'm learning!!
raspberrypi@raspberrypi:~/.hudiy/share/examples/api/python $ python3 KeyStrokes.py
Traceback (most recent call last):
File "/home/raspberrypi/.hudiy/share/examples/api/python/KeyStrokes.py", line 6, in <module>
import common.Api_pb2 as hudiy_api
File "/home/raspberrypi/.hudiy/share/examples/api/python/common/Api_pb2.py", line 5, in <module>
from google.protobuf.internal import builder as _builder
ModuleNotFoundError: No module named 'google'
HUDIY API Example Implementation
Re: HUDIY API Example Implementation
also, I tried to install the correct protobuf but error occurs
raspberrypi@raspberrypi:~/.hudiy/share/examples/api/python $ pip3 install "protobuf~=3.19"
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
For more information visit http://rptl.io/venv
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
raspberrypi@raspberrypi:~/.hudiy/share/examples/api/python $ pip3 install "protobuf~=3.19"
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
For more information visit http://rptl.io/venv
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Re: HUDIY API Example Implementation
Check out this post viewtopic.php?p=152#p152. Here you’ll find instructions on how to set up a Python environment. To avoid cluttering the system, it’s best to use Python’s venv mechanism. This way, different scripts can have different dependency versions thanks to separate virtual environments (https://docs.python.org/3/library/venv.html).