Cannot run the grove_temperature_sensor.py file

I tried to run the python grove_temperature_sensor.py .But when i try the code i get following error:

 Traceback (most recent call last):
  File "grove_temperature_sensor.py", line 57, in <module>
    temp = grovepi.temp(sensor,'1.1')
  File "/home/pi/GrovePi/Software/Python/grovepi.py", line 245, in temp
    a = analogRead(pin)
  File "/home/pi/GrovePi/Software/Python/grovepi.py", line 227, in analogRead
    return number[1] * 256 + number[2]
TypeError: 'int' object has no attribute '__getitem__'
GrovePi Troubleshooting Script
=============================

Adding permissions to the scripts
=================================
chmod: changing permissions of ‘software_status.sh’: Operation not permitted
chmod: changing permissions of ‘avrdude_test.sh’: Operation not permitted
chmod: changing permissions of ‘i2c_test1.sh’: Operation not permitted
chmod: changing permissions of ‘firmware_version_test.sh’: Operation not permitted
tee: log.txt: Permission denied

Check space left
================
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.2G  4.4G  2.6G  64% /
devtmpfs        458M     0  458M   0% /dev
tmpfs           462M  201M  262M  44% /dev/shm
tmpfs           462M  6.4M  456M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           462M     0  462M   0% /sys/fs/cgroup
/dev/mmcblk0p1   42M   21M   21M  50% /boot
tmpfs            93M     0   93M   0% /run/user/1000

Check for dependencies
======================
python 2.7.9-1 install ok installed
python-pip 1.5.6-5 install ok installed
git 1:2.1.4-2.1+deb8u3 install ok installed
libi2c-dev  unknown ok not-installed
python-serial 2.6-1.1 install ok installed
python-rpi.gpio 0.6.3~jessie-1 install ok installed
i2c-tools 3.1.1+svn-2 install ok installed
python-smbus 3.1.1+svn-2 install ok installed
dpkg-query: no packages found matching arduino
dpkg-query: no packages found matching minicom
scratch 1.4.0.6~dfsg1-5 install ok installed

wiringPi Not Found (ERR)
I2C still in blacklist (ERR)
SPI still in blacklist (ERR)


Check for addition in /modules
==============================
I2C-dev already there
i2c-bcm2708 not there (ERR)
spi-dev not there (ERR)


Hardware revision
=================
gpio version: 2.44
Copyright (c) 2012-2017 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Pi 2, Revision: 01, Memory: 1024MB, Maker: Embest 
  * Device tree is enabled.
  *--> Raspberry Pi 2 Model B Rev 1.1
  * This Raspberry Pi supports user-level GPIO access.


Check the /dev folder
=====================
i2c-1
ttyAMA0

USB device status
=================
Bus 001 Device 006: ID 0a5c:bd1e Broadcom Corp. 
Bus 001 Device 005: ID 03f0:034a Hewlett-Packard 
Bus 001 Device 004: ID 046d:c534 Logitech, Inc. 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
        |__ Port 2: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 2: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 3: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 3: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 4: Dev 6, If 0, Class=Vendor Specific Class, Driver=brcmfmac, 480M
Raspbian for Robots Version
===========================
cat: /home/pi/di_update/Raspbian_For_Robots/Version: No such file or directory


Hostname
========
raspberrypi

tee: log.txt: Permission denied

Checking for Atmega chip
========================

./avrdude_test.sh: line 6: avrdude: command not found
tee: log.txt: Permission denied

Checking I2C bus for devices
============================

Checking I2C bus 0
==================
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory

Checking I2C bus 1
==================
     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: -- -- -- -- -- -- -- --                         
tee: log.txt: Permission denied

Checking for firmware version
=============================
Traceback (most recent call last):
  File "/home/pi/GrovePi/Software/Python/grove_firmware_version_check.py", line 40, in <module>
    print("GrovePi has firmware version: %s" %grovepi.version())
  File "/home/pi/GrovePi/Software/Python/grovepi.py", line 266, in version
    return "%s.%s.%s" % (number[1], number[2], number[3])
TypeError: 'int' object has no attribute '__getitem__'

Hi @kwickramanayake007,

My first impression tells me your GrovePi doesn’t have the firmware loaded on it.

And then, there are a couple of questions I want to ask regarding your environment:

  • Do you run Raspbian For Robots and have you updated it to the latest version?

  • How did you set up your environment - meaning what instructions have you followed and if it’s possible could you give us more details about what you have done?

  • If you don’t run on Raspbian For Robots, please give us the exact steps you have followed until now.

The reason I’m asking all these is that I can see inconsistencies in the troubleshooting file, like these:

chmod: changing permissions of ‘software_status.sh’: Operation not permitted
chmod: changing permissions of ‘avrdude_test.sh’: Operation not permitted
chmod: changing permissions of ‘i2c_test1.sh’: Operation not permitted
chmod: changing permissions of ‘firmware_version_test.sh’: Operation not permitted
tee: log.txt: Permission denied

I’m waiting for an answer from you.

Thank you!