0

I have a very simple Python program on my RPi0W to display DHT11 Temp and Pressure readings using SSH. I'm planning to build on it to develop a data logger using MySql. I tested the program and it worked fine.

sshlog.py:

#!/usr/bin/python
import sys
import Adafruit_DHT

while True:

    humidity, temperature = Adafruit_DHT.read_retry(11, 4)

    print 'Temp: {0:0.1f} C  Humidity: {1:0.1f} %'.format(temperature, humidity)

Since I plan to use MySql and perhaps PHP, I then installed MySql and PHP5. I copied sshlog.py to a new file called envirolog.py. I had some trouble with PHPMysql, so I went back to the original sshlog.py and it fails:

pi@RPi0w-Logger:~ $ sudo python sshlog.py Traceback (most recent call last):   
File "sshlog.py", line 7, in <module>
    humidity, temperature = Adafruit_DHT.read_retry(11, 4)   
File "build/bdist.linux-armv6l/egg/Adafruit_DHT/common.py", line 94, in read_retry   
File "build/bdist.linux-armv6l/egg/Adafruit_DHT/common.py", line 80, in read   File "build/bdist.linux-armv6l/egg/Adafruit_DHT/common.py", line 55, in get_platform   
File "build/bdist.linux-armv6l/egg/Adafruit_DHT/Raspberry_Pi_2.py", line 22, in <module> 
ImportError: cannot import name Raspberry_Pi_2_Driver

Now I'm stuck. I did not change anything about the hardware. Did my install of MySql and PHP5 screw up Adafruit?

  • Can you still run AdafruitDHT.py? Have you tried to reinstall the package? – Dmitry Grigoryev Jun 26 '18 at 10:30
0

I went back and reinstalled the ADAFruit libraries. It worked. Dunno what I screwed up, but it was resolved by rerunning the install process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.