You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.
On a clean system, following the README instructions for venv installation exactly as written doesn't work.
$ source .venv/bin/activate
$ sudo ./gateway.py
Traceback (most recent call last):
File "/home/pi/bt-mqtt-gateway/./gateway.py", line 11, in <module>
import logger
File "/home/pi/bt-mqtt-gateway/logger.py", line 3, in <module>
import yaml
ModuleNotFoundError: No module named 'yaml'
I admit I'm not super familiar with python but afaik it doesn't make sense to activate the venv and then run sudo, as the env vars (specifically the python path) set by activating will anyway be ignored once we are running as a root so we will effectively be running outside the venv and thus will be missing the dependencies that were installed inside it.
./gateway.py would run using the venv packages but on my system at least it fails because you need to be root to run the BT scan. Calling the venv's python binary directly as root seems to work (no need to activate venv first but equally wouldn't do any harm): $ sudo .venv/bin/python gateway.py
Similarly, service.sh needs to be edited. It correctly sets the PATH to include the venv path but then undoes that work by using sudo, which is unnecessary as systemd services already run as root afaik. Simply removing sudo from the last line fixes it, i.e.: python3 ./gateway.py "$@"
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
On a clean system, following the README instructions for venv installation exactly as written doesn't work.
I admit I'm not super familiar with python but afaik it doesn't make sense to activate the venv and then run sudo, as the env vars (specifically the python path) set by activating will anyway be ignored once we are running as a root so we will effectively be running outside the venv and thus will be missing the dependencies that were installed inside it.
./gateway.py
would run using the venv packages but on my system at least it fails because you need to be root to run the BT scan. Calling the venv's python binary directly as root seems to work (no need to activate venv first but equally wouldn't do any harm):$ sudo .venv/bin/python gateway.py
Similarly, service.sh needs to be edited. It correctly sets the PATH to include the venv path but then undoes that work by using sudo, which is unnecessary as systemd services already run as root afaik. Simply removing sudo from the last line fixes it, i.e.:
python3 ./gateway.py "$@"
The text was updated successfully, but these errors were encountered: