Sorry, this will be a long reply…
I’m not sure if your ink solve the problem (I think is not the same origin, we are using python2 and that one is related to python3), but I found a solution myself.
From your link I saw the library used is now updated to version 1.3.2, we use 1.3.1. Not sure if the new version fix the 2 different bug I found (I checked now, they added the Raspberry Pi 3 family), but it is pretty simple to fix by ourself.
The first one is about in the platform_detect module of the library. It check for the CPU Hardware name in /proc/cpuinfo file, but the one for the Zero W is not listed as an option. I modified the if condition to match the BCM2835 processor of the W and this bug is gone.
The second one come out with next step. I modified the Hardware name to let the library think I’m using a Raspberry Pi 2, but the code fail to load a driver because an import statement have a misspelled name.
So, since the library is a simple .zip file renamed as .egg, you can copy the Adafruit_DHT-1.3.1-py2.7-linux-armv6l.egg library from /usr/local/lib/python2.7/dist-packages/ and uncompress it (you can use the python command
python -m zipfile -e /usr/local/lib/python2.7/dist-packages/Adafruit_DHT-1.3.1-py2.7-linux-armv6l.egg target-dir/).
Then you need to modify the files interested by the bugs:
-
platform_detect.py: change the very last block to
elif match.group(1) == 'BCM2835':
# Pi 2
return 2 -
Raspberry_Pi_2.py: change the line
from . import Raspberry_Pi_2_Driver as driver
to
from . import Raspberry_Pi_Driver as driver)
Now you can zip the whole folder again and overwrite the original one (you want to make a backup first). Again you can use the python command
python -m zipfile -c Adafruit_DHT-1.3.1-py2.7-linux-armv6l.egg Adafruit_DHT/
The new version from Adafruit seems to be more complex and I don’t think is a good idea trying to install that one. I can provide my modded library if someone needs it.
I hope this fix will help someone.
Bye!