[SOLVED] "Type Error - no attribute getitem" - with AirQuality sensor



I have groovepi+ board. I have followed this tutorial to install all the librares.

When I run sudo i2cdetect -y 1 I can see the 04 output which means my Raspberry is able to detect the GrovePI.

I have as well installed the python package. Pip freeze returns grovepi==0.0.0 as one of the packages.

My sensor is attached to A0. It’s blue light is on.

But when I try to run:

sudo python grove_air_quality_sensor.py

I get the following error:

Traceback (most recent call last):
File “grove_air_quality_sensor.py”, line 51, in
sensor_value = grovepi.analogRead(air_sensor)
File “/home/pi/Projects/GrovePi/Software/Python/grovepi.py”, line 226, in analogRead
return number[1] * 256 + number[2]
TypeError: ‘int’ object has no attribute ‘getitem

I am totally stuck so any help would be sincerely appreciated.

Thank you in advance.


Hi @p.kuralt,

I’m assuming you’ve successfully installed the libraries for the GrovePi platform by following the tutorial from the link you’ve shared in your post.

I think we need to update the firmware of the GrovePi.
The way to do this is by entering in a terminal, on your Raspberry Pi, the following commands:

cd ~/Desktop/GrovePi/Firmware/
sudo bash firmware_update.sh

Everytime the firmware_update.sh script asks you for entering Y/N, please, always enter Y, otherwise entering N and hitting enter will lead to a failed update.

After you’ve succeeded updating the GrovePi's firmware, you can retry running the program you wanted to run in the first place.

I’ll be here for any other questions you might have.

Thank you!


Dear Robert.

Thank you so very much for your answer.

After updating the firmware everything works perfectly.

Thank you once again for your time and support.