Skip to content

Initialization error? #69

@yeyeto2788

Description

@yeyeto2788

Please take a look at the following snippet (explanation after it):

(venv) pi@raspberrypi:~/mudpi-core $ python
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
>>> import adafruit_dht
>>> dht = None
>>> dht
>>> type(dht)
<class 'NoneType'>
>>> dht = adafruit_dht.DHT11(board.D26)
>>> Unable to set line 26 to input

>>> type(dht)
<class 'adafruit_dht.DHT11'>
>>> dht._use_pulseio
True
>>> dht = adafruit_dht.DHT11(board.D26, use_pulseio=False)
>>> dht._use_pulseio
False
>>> dht.temperature
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/mudpi-core/venv/lib/python3.7/site-packages/adafruit_dht.py", line 243, in temperature
    self.measure()
  File "/home/pi/mudpi-core/venv/lib/python3.7/site-packages/adafruit_dht.py", line 199, in measure
    raise RuntimeError("A full buffer was not returned. Try again.")
RuntimeError: A full buffer was not returned. Try again.
>>>

Expected behavior:
Could not instantiate the DHT object as when setting the use_pluseio to False so behavior is the same and instantiation can be handled the same way.

Issue/Doubt:
Shouldn't the library raise an Exception when (by default) use_pulseio is set to True instead of actually instantiate the DHT11 object?

SBC: Raspberry Pi A+
Libraries:

Adafruit-Blinka==6.4.1
adafruit-circuitpython-dht==3.5.5
Adafruit-PlatformDetect==3.4.1
Adafruit-PureIO==1.1.8

Python: 3.7.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions