adafruit/Adafruit_Python_DHT

Semaphore not finding library

lpuv opened this issue · 4 comments

lpuv commented

I am running some code that uses the library to upload code to thingspeak.
It keeps saying that it did not find the library!
I ran the follwing commands on semaphore...
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
sudo apt-get install build-essential python-dev
sudo python setup.py install --force-pi
cd ../
python main.py

Please help!

Semaphore emulator on Chromebook

Google Chrome 69.0.3497.120 (Official Build) (64-bit)
Revision 82a246f0f3c05b70641ab513b5fd749c1c62e19d-refs/branch-heads/3497@{#980}
Platform 10895.78.0 (Official Build) stable-channel wolf
Firmware Version Google_Wolf.4389.24.62
JavaScript V8 6.9.427.30
Flash 31.0.0.108 /opt/google/chrome/pepper/libpepflashplayer.so
User Agent Mozilla/5.0 (X11; CrOS x86_64 10895.78.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.120 Safari/537.36
Command Line /opt/google/chrome/chrome --ppapi-flash-path=/opt/google/chrome/pepper/libpepflashplayer.so --ppapi-flash-version=31.0.0.108 --ui-prioritize-in-gpu-process --use-gl=egl --enable-native-gpu-memory-buffers --gpu-sandbox-failures-fatal=yes --enable-logging --log-level=1 --use-cras --enable-wayland-server --user-data-dir=/home/chronos --login-profile=user --has-chromeos-keyboard --guest-wallpaper-large=/usr/share/chromeos-assets/wallpaper/guest_large.jpg --guest-wallpaper-small=/usr/share/chromeos-assets/wallpaper/guest_small.jpg --child-wallpaper-large=/usr/share/chromeos-assets/wallpaper/child_large.jpg --child-wallpaper-small=/usr/share/chromeos-assets/wallpaper/child_small.jpg --default-wallpaper-large=/usr/share/chromeos-assets/wallpaper/oem_large.jpg --default-wallpaper-small=/usr/share/chromeos-assets/wallpaper/oem_small.jpg --default-wallpaper-is-oem --enable-consumer-kiosk --enterprise-enrollment-initial-modulus=15 --enterprise-enrollment-modulus-limit=19 --login-manager --first-exec-after-boot --vmodule=nss_cert_database_chromeos=1,/assistant/=1,chromeos/login/=1,auto_enrollment_controller=1,/ui/ozone/=1,/ui/display/manager/chromeos/=1,night_light=1,update_engine=1,component_updater_service=1,power_button_observer=2,webui_login_view=2,lock_state_controller=2,webui_screen_locker=2,screen_locker=2
Executable Path /opt/google/chrome/chrome
Profile Path /home/chronos/u-bc32acc5c305c8d2439955bb8462a1b052d52a7c
Variations 3e006338-3f4a17df2b6ab552-ca7d8d80752a9400-3d47f4f4b7e2524c-ca7d8d808fe39baa-3f4a17df3095aa95-3f4a17df7c1bc906-f55a797447e5d3db-3d47f4f4d442dfb7-ca7d8d809ca1387e-3f4a17df1149accc-5c9438774dc30737-b8a5ea08af59fc20-2599138cc865fdc1-ca7d8d80a582a1b8-ad75ce178ee5ed19-ca7d8d8074658432-ca7d8d80d0c20ec2-a9390bd0ebbb4e0a-ca7d8d8098be3390-d93a062088a387d2-ee748cefedbcf7c5-1cc1312c43f62d3b-28165b593a0563a1-65222f0b6a82868d-3f4a17df9e5c75f1-f2aa3db86872f671-991e1e1f79cb77b-3f4a17df6e6e0c7e-3f17a7d8d92562a9-4d2fac874da5ae82-91c810ef2c1d398c-3f4a17df6973a1cf-3f4a17dfcc54eb06-28165b5958a025e3-36e97b2cdf072bba-ca7d8d80ff29b1bd-37ef7e174bc337ce-69465896d1466cda-3f4a17dfddf77e2c-ca7d8d801354da85-f1a864dc17507c76-ca7d8d80494d8760-52325d433ac60855-486e2a9cf296190c-30f715f34442aae2-a90023b1ed1d377-e1cc0f1475f0f0a0-4ad60575e2b18481-6e597edee7e71889-4ad605753a8271ac-12c226b1ceb06f-d13723343a4029d-ca7d8d8081c6897f-3d47f4f4

python 2.7

Traceback (most recent call last):
File "main.py", line 4, in
import Adafruit_DHT as dht
ImportError: No module named Adafruit_DHT

import sys
import urllib2
from time import sleep
import Adafruit_DHT as dht

Enter Your API key here

REDACTED

URL where we will send the data, Don't change it

baseURL = 'https://api.thingspeak.com/update?api_key=%s' % myAPI
def DHT22_data():
# Reading from DHT22 and storing the temperature and humidity
humi, temp = dht.read_retry(dht.DHT22, 23)
return humi, temp
while True:
try:
humi, temp = DHT22_data()
# If Reading is valid
if isinstance(humi, float) and isinstance(temp, float):
# Formatting to two decimal places
humi = '%.2f' % humi
temp = '%.2f' % temp

		# Sending the data to thingspeak
		conn = urllib2.urlopen(baseURL + '&field1=%s&field2=%s' % (temp, humi))
		print conn.read()
		# Closing the connection
		conn.close()
	else:
		print 'Error'
	# DHT22 requires 2 seconds to give a reading, so make sure to add delay of above 2 seconds.
	sleep(20)
except:
	break

I'm afraid I'm not familiar with Semaphore - could you provide more context here?

lpuv commented

Semaphore is like GitLab Runners, using jobs to execute commands. It simulates a Linux environment.
Thanks

hi this repo is going to be deprecated soon, please try
https://github.com/adafruit/Adafruit_CircuitPython_DHT
which will replace this library