Getting 'TypeError: 'int' object has no attribute '__getitem__' testing airquality sensor (python)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 494
- Forks
- 472
- PR merge metrics
- No merged PRs in 30d
Description
Just got my new GrovePi+ board and I when through the install process using the 'Quick Start' method:
sudo curl -kL dexterindustries.com/update_grovepi | bash
tested the board using:
sudo i2cdetect -y 1
and got the OK with the following result and installed the sensor on the A0 interface:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- 04 -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
The issue is when running the example test script for the air sensor I have I get a TypeError:
Traceback (most recent call last):
File "grove_air_quality_sensor.py", line 46, in <module>
sensor_value = grovepi.analogRead(air_sensor)
File "/home/pi/Dexter/GrovePi/Software/Python/grovepi.py", line 227, in analogRead
return number[1] * 256 + number[2]
TypeError: 'int' object has no attribute '__getitem__'
Everything lights up fine the board is fine. I think the issue is the script itself or maybe a version issue. Any help would be great. TY
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the air sensor example in grove_air_quality_sensor.py and inspect the analogRead call at grovepi.py line 227. Trace the value returned for the A0 sensor and compare it with the indexing used there; done means the example runs without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, raspberry-pi
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100