Raspberry Pi OS - Python Script scenarios to Access GPIO Pins with Permission Denied scenarios
This might be a silly question, but I'm stuck trying to I tried several approaches but none seem to work... I’m running a Python script on Raspberry Pi OS (based on Debian 11) to control GPIO pins, but I'm working with a 'Permission Denied' behavior when trying to access them. My script uses the `RPi.GPIO` library to set up and control the pins, but when I execute it, I get the following behavior: ``` RuntimeError: No access to /dev/gpiomem. Please run as root. ``` I have tried running the script with `sudo python3 myscript.py`, but I still receive the same behavior. My script is fairly straightforward: ```python import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.OUT) GPIO.output(18, GPIO.HIGH) ``` I’ve also verified that the `RPi.GPIO` library is installed (version 0.7.0) and that my user is a member of the `gpio` group, which I thought would allow access. I checked using: ```bash groups myusername ``` But it doesn't seem to help. I've looked through various forums, but I haven't found a clear solution. Is there a specific configuration that I might be missing, or is there a better way to run this script without working with permission issues? Any insights would be greatly appreciated! For context: I'm using Python on Windows. How would you solve this? This is part of a larger REST API I'm building. This issue appeared after updating to Python 3.9. What's the correct way to implement this? For reference, this is a production web app. Thanks for your help in advance!