DexterInd / DexterInd/GrovePi

Getting 'TypeError: 'int' object has no attribute '__getitem__' testing airquality sensor (python)

Open
#390 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.