[SOLVED] no module named grove_rgb_lcd


#1

Hi, I am a newbie with RaspberryPi and GrovePi
I am running a python program and having problems
First I had to run this command:
sudo apt-get install python-setuptools
Then:
sudo python setup.py install

Now I get this when I run: sudo python temp_humi_sensor.py
ImportError : No module named grove_rgb_lcd.

Help me please.


#2

Hey,
Can you post the program that you are trying to use. Are you using the grove_rgb_lcd in which case you should keep it’s python library in the same folder as your program too.

-karan


#3

its the same program that gets downloaded with the GrovePi install:

Home_Weather_Display.py

This is an project for using the Grove RGB LCD Display and the Grove DHT Sensor from the GrovePi starter kit

In this project, the Temperature and humidity from the DHT sensor is printed on the RGB-LCD Display

Note the dht_sensor_type below may need to be changed depending on which DHT sensor you have:

0 - DHT11 - blue one - comes with the GrovePi+ Starter Kit

1 - DHT22 - white one, aka DHT Pro or AM2302

2 - DHT21 - black one, aka AM2301

For more info please see: http://www.dexterindustries.com/forum/?topic=537-6c-displayed-in-home-weather-project/#post-4485

‘’'
The MIT License (MIT)

GrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi.
Copyright © 2015 Dexter Industries

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
’’’

from grovepi import *
from grove_rgb_lcd import *

dht_sensor_port = 7 # Connect the DHt sensor to port 7
dht_sensor_type = 1 # change this depending on your sensor type - see header comment

while True:
try:
[ temp,hum ] = dht(dht_sensor_port,dht_sensor_type) #Get the temperature and Humidity from the DHT sensor
print “temp =”, temp, “C\thumidity =”, hum,"%"
t = str(temp)
h = str(hum)

	setRGB(0,128,64)
	setRGB(0,255,0)
	setText("Temp:" + t + "C        " + "Humidity :" + h + "%")			
except (IOError,TypeError) as e:
	print "Error"

#4

Where is the python library?


#5

Never mind I found it and put it with the same folder as my python program
Although the dispaly is not showing high readings, I think I can figure that out for myself.
If I cant then I will post here.


#6

Another issue came-up.
like I said before I was gettin g high readings like Temp 588°C and Humi 1170 %
I tried to devide both by a determined number tyhat was close to actual room values.
I ran the program and would gett the following error after many values:
ValueError: cannot convert float NaN to integer

I removed the divisions to see what I would get raw and I did get the value nan everyone in a while.
I am starting to wonder if there is a problem with the sensor.


#7

Ok my bad didnt read the note that I had to specify the sensor type.
However it says the blue is number 0 which is what I have but I was getting zeros on the for values.
I tried number 2 and it worked.
Dont know if its a typo in the docs but I am happy nonetheless.


#8

I wonder if we should update the install script to add the lcd module in globally?


#9

I agree


#10

Hi there, also an absolute noob and try to run the examples from the GrovePi+ Starter Kit but hitting this error, which folders did you copy and where did you copy them to?

Thanks,
Tim


#11

Hi @tim1,

If I am right you are trying to use the example on Home weather display. If this is the case then you will have to copy the library grove_rgb_lcd.py from here to the folder which has the example that you are running.

Even if its some other example you will have to copy the library used in the program to the same folder as your program. To find the location of the library you might have to search a bit here or you can reach out to us on a new post.

Note: If the error is with the library grovepi.py you don’t have to copy this library, instead you can install this library globally by changing the directory to GrovePi and running the command sudo python setup.py install.

-Shoban