okay. so, followed your steps to enable system wide access. was hopeful, because it worked in the new environment. But, I get these errorsactivate your venv
then type python
you are now in the Python REPL/Terminal, and you can use python commands
type
import RPi.GPIO
it should fail
try
import lgpio
it should also fail
Exit your venv
go to your venv folder, edit pyvenv.cfg
It should be obvious once in there what to set to true. [ set include-system-site-packages = true ]
save and reactivate, start python, test the imports.
It should work.
I just tested here to make sure.
I mention lgpio as it may be a good time to try and move over to it. BUT get RPi.GPIO working first. Scrap that you'd have to rewrite the modules unless Waveshare have updated it.
Actually, I don't think you need to import RPi.GPIO in your python code, as the module (where it is failing) does that for the module, your code doesn't use it as far as I can see. Unless it's just a failsafe if the module doesn't shutdown on an error.?
in the new environment, I now see this (quote below) in Thonny when testing the script and scanning the nfc tag.. However, in terminal the program starts up and runs. But neither Thonny nor Terminal will play the music, as it does in the original environment.(my_venv) xxxxx@raspberrypi:~ $ /home/xxxxx/my_venv/lib64/python3.11/site-packages/player.py
Traceback (most recent call last):
File "/home/xxxxx/my_venv/lib64/python3.11/site-packages/player.py", line 5, in <module>
import spotipy
File "/home/xxxxx/my_venv/lib/python3.11/site-packages/spotipy/__init__.py", line 1, in <module>
from .cache_handler import * # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxxx/my_venv/lib/python3.11/site-packages/spotipy/cache_handler.py", line 16, in <module>
from redis import RedisError
File "/home/xxxxx/my_venv/lib/python3.11/site-packages/redis/__init__.py", line 1, in <module>
from importlib import metadata
File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 17, in <module>
from . import _adapters, _meta
File "/usr/lib/python3.11/importlib/metadata/_meta.py", line 1, in <module>
from typing import Any, Dict, Iterator, List, Protocol, TypeVar, Union
File "/home/xxxxx/my_venv/lib/python3.11/site-packages/typing.py", line 1359, in <module>
class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
File "/home/xxxxx/my_venv/lib/python3.11/site-packages/typing.py", line 1007, in __new__
self._abc_registry = extra._abc_registry
^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Callable' has no attribute '_abc_registry'
Card Value is: b'\x04,1\x9d\xc1*\x81'
[Errno 98] Address already in use
Statistics: Posted by just_a_beginner — Mon Dec 23, 2024 2:01 am