Hi,
What is the output when you run the python code?
I think you didn’t installed the GrovePi python package , You need to install the Grove.py python package, I’ll guide you step by step. You can download the package by entering this command after installation, try running your code and let us know the feedback.
</s> curl -sL https://github.com/Seeed-Studio/grove.py/raw/master/install.sh | sudo bash -s -<e>